You can make you own autograded SQL problems in CodeHS Create. There are only a few steps to writing a good SQL program, and you can see a demo in the video below!
Create an assignment from Create page or Assignments page
Step 1: Create a SQL Exercise
Choose Coding Exercise > Select a SQL Program Type
Fill in assignment details: title, description, and starter code, solution code
Step 2: Add Data through Advanced Settings
Click edit next to your assignment
Click on Advanced Settings (bottom left)
Click the SQL Setup Code Tab
Add your data
SQL Setup Code
You can use this sample code to help create tables and add data:
CREATE TABLE Name (id, first_name, last_name, house);
INSERT into Name values ("1", "Harry", "Potter", "1");
INSERT into Name values ("2", "Ron", "Weasley", "1");
INSERT into Name values ("3", "Hermione", "Granger", "1");
INSERT into Name values ("4", "Severus", "Snape", "4");
CREATE TABLE House (house_name, house_id);
INSERT into House values ("Gryffindor", "1");
INSERT into House values ("Ravenclaw", "2");
INSERT into House values ("Hufflepuff", "3");
INSERT into House values ("Slytherin", "4");
SELECT * FROM Name;
SELECT * FROM House;
Create an assignment in a Playlist
Start by creating a playlist, and make a new activity. Choose SQL for the problem type.
Write a description describing what your students should query.
Load in Data in the SQL Setup Code tab by writing queries that generate a Database with your content.
Write the correct query in the Solution Code section of the Code tab.
Assign to your students! They'll be able to load the problem, start with the preloaded data, and write queries. The autograder will automatically check if their results match what your solution code produces.
Still have questions? Contact our team at firstname.lastname@example.org to learn more!