Overview
You can create a Database Engineering Question to test candidates on their knowledge of database management systems. Database Management System refers to the technology of storing, modifying retrieving data of the users efficiently while taking appropriate security measures. You can test a candidate's knowledge of the queries through a Database Engineering question to retrieve relevant data. This article will take you through creating a Database Engineer question.
HackerRank supports Microsoft SQL, MySQL, Oracle, and DB2 databases.
Steps to Create a Database Engineer Question
- Click on the Library tab on the home page and then click on the Create Question button.
- In the Select Question Type dialog box, under the Roles-based category, click on Database.
- On the Problem Statement page, specify:
A. Problem Name
The problem name should be short and topical. It should not give any hints to solve the problem.
B. Score
While you can assign any score you want for the questions you create, we use certain standards for assigning scores to the questions we create that you might find useful.
Score |
Question Type |
50 points |
For an easy question that can be solved in 15 minutes |
75 points |
For a medium question that can be solved in 30 minutes |
100 points |
For a difficult question that can be solved in 45 to 60 minutes |
C. Tags
Tags are words or phrases that help with the searchability and organization of your questions. You can add the existing tags or create new tags and set the difficulty level for your Question by associating the tags as Easy, Medium, or Hard. Alternatively, associate custom Tags to identify your Question by its complexity or levels.
a. Click on the Tags drop-down, and type a keyword. Example, Easy.
b. Click on the Add option. The “Easy” tag is associated with the Question.
When you view your Questions in the Library, the associated tags will be indicated for every Question. You can use these Tags to generate candidate reports and performance graphs.
Refer to the Setting the Difficulty Level for Questions for more information.
D. Problem Description
You must describe the data schema with which the candidate will be working and explicitly state any constraints. Also, indicate what data has to be retrieved for this problem.
Click on the Templates option to use the predefined HackerRank's Database Question template to define your problem clearly.
Refer to the Defining the Problem Statement: Coding and Database Engineer Questions topic.
Tip: Specify the table definitions with any constraints
E. Interviewer Guidelines
Interviewer Guidelines are for later reference. You can include a rubric about scoring the questions or write solutions to the problems here. These can be used by your team while evaluating the test. These are only visible to your team and you; however, candidates cannot view these notes.
You can support your problem statement and Interviewer Guidelines by attaching a relevant reference file in these sections. Refer to How to Attach a File to a Problem Statement for more information.
4. Click on the Save & Proceed button.
5. On the Tables page, select the checkboxes for the databases that candidates can use to solve this problem.
6. Perform one of the following operations to upload a table:
a. Click on the Uploading a SQL option to upload an SQL file from your local system. The Upload SQL dialog box displays. This method is recommended. You can upload multiple tables at once by using this option.
The SQL file size to be uploaded must be less than 64KB. You can view the table name, column description, and the number of records in each table that you uploaded.
b. Click on the New Table using the CSV option to upload the DB Schema using a CSV file. In the displayed dialog box, specify the table name.
Click on the Upload a CSV File button to upload a CSV file from your local system.
You can only upload one file at a time. Repeat this step to upload multiple files. The size of each individual file must be less than 64 KB.
c. You can write SQL for the table data in the Schema section and click Verify Schema to ensure that SQL written to create tables is correct.
Note: If your table contains floating-point data, it might be represented differently for each database. Refer to the example given in the table below.
Database | Floating Point Data | Difference |
Original Table | 0.59 |
|
Oracle | .59 | Removes the leading zero |
MySQL | 0.59 | Prints the data as it was provided |
MS SQL | 0.58999997 | Prints an approximation of the value |
DB2 | .59 | Removes the leading zero |
7. Click on the Save & Proceed button.
8. In the Expected Output section of the Output page, specify the expected output for this question. The expected output is compared with the data retrieved by the candidate's query.
9. Click on the Show Advanced Settings option to view and edit the expected output advanced settings.
This step is optional.
a. Clear the Ignore row order while matching the output checkbox to disable this option.
By default, this option is enabled. If this option is enabled, then the row order of the candidate's output is not considered when scoring. However, if you disable this option candidate's output should exactly match the expected output.
For example: If a question asks you to print the three largest cities in the world by area from a database, and the expected output given by the question setter is:
ID | City |
1 | New York |
2 | Tokyo |
3 | Chicago |
However, the Ignore row order while matching output option is disabled, and a candidate prints the answer as:
ID | City |
1 | Tokyo |
2 | Chicago |
3 | New York |
Then this answer is marked correct, and the candidate scores full points. However, if this option is enabled, then the row order is considered, and the candidate gets a zero score.
b. Clear the Show expected output to candidates check box if you do not want the candidates to view the expected output. By default, this option is enabled, and candidates can view the expected output.
c. Select the Allow DB to write permissions to candidates check box to allow candidates to edit the database.
By default, this option is disabled, and candidates cannot edit the database provided by the test setter.
10. In the Code Stub area, you can define the header and tail section for the query to be written by the Candidates.
11. Click on the Save Question button to save the question and exit. Alternatively, click Save & Add another to save this question and proceed to create another one.
The Questions you create are stored in the HackerRank Library under the “My company questions” section. The Question type and the associated tags are indicated below every Question title as shown below.
While in the Library, you can proceed to create more questions or add Questions to your Tests.