To create a database task click on Tests >> Tasks Library >> +Create new task and choose the Database type of question.
In order to create your own task you need to create a database. In the 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 configuration your Database task:
- Ask candidate to write their own query/script to extract expected data;
- Let your candidate edit the query/script 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 source will be hidden from candidate. Candidate 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 tables 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.