To create a database task click on Tests >> Tasks Library >> +Create a new task and choose the Database type of question
In order to create your own task, you need to create a database. In section number three "Configure SQL assignment" pick the Database engine (MySQL, MSSQL, PostgreSQL, Oracle, or HSQLDB) and place your Schema initialization script. Please prepend each CREATE TABLE <name> with DROP TABLE <name> to make it possible to repeatedly execute this script.
DROP TABLE users;
CREATE TABLE users ( id INT, name VARCHAR(255) );
INSERT INTO users ( id, name ) VALUES ( 1, 'John');
INSERT INTO users ( id, name ) VALUES ( 2, 'Alice');
There are a few options for configuring your Database task:
Ask candidate to write their own query to extract expected data;
Let your candidate edit the query prepared by you to implement the necessary changes.
Provide expected results in CSV format or a database query. Expected results will be compared with an output of the candidate's query. Expected results will be hidden from the candidate. Candidates will see only tabular data.
Choose CSV or SQL format and input your correct answer. Save and publish the task.
NOTE: Please remember to add the data structure to the question section in order to demonstrate the table structure of the database that the candidate will have to write queries for. Note, that you can use markdown to make it look even better.
While editing the task you will encounter the “Create additional verification test case” button. It’s meant for adding more hidden verification tests to the task. These are unit tests that the candidate can’t see during the test.
By using this method you can add multiple test cases, choose the one you want to use from the list and remove the selected one by clicking the “Remove current test case button”: