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. Through a Database Engineering question, you can test a candidate's knowledge of the queries to retrieve relevant data.
Currently, HackerRank supports Microsoft SQL, MySQL, Oracle, and DB2 databases.
- You must be logged in to your HackerRank for Work account.
- Click Library tab on the home page and then click Create Question
The HackerRank Library page
- In the Select Question Type dialog box, under the Roles-based category, click Database Engineer.
Selecting a Database Engineer type Question
- In 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.
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.
For an easy question that can be solved in 15 minutes
For a medium question that can be solved in 30 minutes
For a difficult question that can be solved in 45 to 60 minutes
Tags are words or phrases that help with 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 the Tags drop-down, and type a keyword. Example, Easy.
b. Click Add, 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 Setting the Difficulty Level for Questions for more information.
D. Problem Description
You must describe the data schema with which candidate will be working and explicitly state any constraints. Also, indicate what data has to be retrieved for this problem.
Click 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 for more information.
Tip: Specify the table definitions with any constraints.
E. Internal Notes
Internal notes 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. Internal notes are only visible to your team and you; however, candidates cannot view these notes.
You can support your problem statement and internal notes by attaching a relevant reference file in these sections. Refer How to Attach a File to a Problem Statement for more information.
4. Click Save & Proceed.
5. In the Tables page, select the check boxes for the databases that candidates can use to solve this problem.
6. Perform one of the following operations to upload a table:
a. Click uploading a SQL 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 size of the SQL file to be uploaded must be less than 100 MB.
Step Result: You can view the table name, column description, and the number of records in each table that you uploaded.
b. Click New Table using CSV to upload the DB Schema using a CSV file. In the displayed dialog box, specify the table name.
Click Upload a CSV File 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 in different ways for each database. Refer to the example given in the table below.
|Database||Floating Point Data||Difference|
|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 Save & Proceed.
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 Show Advanced Settings to view and edit the expected output advanced settings.
This step is optional.
a. Clear the Ignore row order while matching 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 taken into consideration when scoring. However, if you disable this option candidate's output should exactly match with 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:
However, the Ignore row order while matching output option is disabled and a candidate prints the answer as:
Then this answer is marked correct and the candidate scores full points. However, if this option is enabled, then the row order is taken into consideration 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 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 Save Question 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.