SQL for teachers: exercises for classes, courses and bootcamps
Setting up a database server for a class of thirty is where many SQL lessons stall. Here your students write real queries in the browser from the first minute, every answer is checked straight away, and you can follow their progress as a class.
In short: the SQL course runs entirely in the browser on a practice database of an office supplies shop. Level 1 and the first exercise of every lesson are free. Schools can ask for a free class code for one school year; bootcamps and training providers buy seats through the team plan.
Why teach SQL with browser exercises
The hard part of an SQL class is rarely SELECT itself. It is the setup: installing a database, loading sample data, fixing connection errors, and then checking thirty slightly different queries by hand. LearnThisNext takes that part away:
- Nothing to install. Every exercise runs on our server, so it works on locked-down school computers, Chromebooks and tablets. The practice database is SQLite and is loaded fresh for every query, so nobody can break it for anyone else.
- Instant, specific feedback. Each exercise has three hints that get more concrete, a model answer and an explanation. Error messages tell students what is off: wrong columns, too many rows, a missing sort order.
- Copying results does not work. The server also runs every query on changed data that nobody sees. A typed-in result or a query that only fits the visible rows fails.
- The result counts, not the wording. A join or a subquery, BETWEEN or two comparisons: any query that returns the right rows and columns is accepted. That leaves room to discuss different solutions in class.
Try two exercises
This is what your students see: the tables above the editor, the query box, and an immediate check. The first task is a filter, the kind of query that opens most first lessons on databases:
Task Sales is planning visits in Boston. From the customers table, show the columns name and phone, but only for customers whose city is Boston.
customers 12 rows, 7 columns
| customer_id | name | city | country | customer_since | segment | phone |
|---|---|---|---|---|---|---|
| 1 | Harbor Fremont Partners | Boston | USA | 2021-03-15 | Business | 617-555-0142 |
| 2 | Emily Carter | Chicago | USA | 2022-07-01 | Consumer | NULL |
| 3 | Riverside County Office | Riverside | USA | 2020-11-20 | Government | 951-555-0110 |
| 4 | Raj Patel | Leeds | UK | 2023-01-09 | Consumer | 0113 496 0123 |
| 5 | Lakeview Hotel Ltd | Manchester | UK | 2022-04-18 | Business | 0161 496 0456 |
| 6 | Olivia Brooks | Austin | USA | 2024-02-27 | Consumer | NULL |
| 7 | Greene & Shaw LLP | London | UK | 2021-09-05 | Business | 020 7946 0321 |
| 8 | Maple Grove High School | Austin | USA | 2023-08-14 | School | 512-555-0187 |
| 9 | Chloe Evans | Boston | USA | 2025-05-30 | Consumer | 617-555-0199 |
| 10 | Northline Printing Co | Toronto | Canada | 2020-06-12 | Business | 416-555-0133 |
| 11 | Daniel Kim | Seattle | USA | 2024-10-03 | Consumer | NULL |
| 12 | Westbrook Dental Clinic | Chicago | USA | 2022-12-01 | Business | 312-555-0164 |
The second joins two tables on a key, the topic where many learners first get stuck. It comes from level 3 of the course and is free.
Task The orders table only stores a customer_id, but customer service wants to see names. For every order, show order_id and order_date from orders and the customer's name from customers.
orders 18 rows, 5 columns
| order_id | customer_id | order_date | status | employee_id |
|---|---|---|---|---|
| 1001 | 1 | 2026-01-08 | delivered | 3 |
| 1002 | 4 | 2026-01-12 | delivered | 4 |
| 1003 | 3 | 2026-01-20 | delivered | 3 |
| 1004 | 7 | 2026-02-03 | delivered | 4 |
| 1005 | 2 | 2026-02-11 | cancelled | 8 |
| 1006 | 1 | 2026-02-25 | delivered | 3 |
| 1007 | 10 | 2026-03-04 | delivered | 2 |
| 1008 | 5 | 2026-03-17 | delivered | 4 |
| 1009 | 8 | 2026-03-30 | delivered | 3 |
| 1010 | 6 | 2026-04-07 | delivered | 8 |
| 1011 | 12 | 2026-04-22 | delivered | 4 |
| 1012 | 3 | 2026-05-06 | delivered | 3 |
| 1013 | 9 | 2026-05-19 | cancelled | 8 |
| 1014 | 7 | 2026-06-02 | shipped | 4 |
| 1015 | 1 | 2026-06-10 | shipped | 3 |
| 1016 | 11 | 2026-06-12 | open | NULL |
| 1017 | 4 | 2026-06-13 | open | NULL |
| 1018 | 10 | 2026-06-14 | open | NULL |
customers 12 rows, 7 columns
| customer_id | name | city | country | customer_since | segment | phone |
|---|---|---|---|---|---|---|
| 1 | Harbor Fremont Partners | Boston | USA | 2021-03-15 | Business | 617-555-0142 |
| 2 | Emily Carter | Chicago | USA | 2022-07-01 | Consumer | NULL |
| 3 | Riverside County Office | Riverside | USA | 2020-11-20 | Government | 951-555-0110 |
| 4 | Raj Patel | Leeds | UK | 2023-01-09 | Consumer | 0113 496 0123 |
| 5 | Lakeview Hotel Ltd | Manchester | UK | 2022-04-18 | Business | 0161 496 0456 |
| 6 | Olivia Brooks | Austin | USA | 2024-02-27 | Consumer | NULL |
| 7 | Greene & Shaw LLP | London | UK | 2021-09-05 | Business | 020 7946 0321 |
| 8 | Maple Grove High School | Austin | USA | 2023-08-14 | School | 512-555-0187 |
| 9 | Chloe Evans | Boston | USA | 2025-05-30 | Consumer | 617-555-0199 |
| 10 | Northline Printing Co | Toronto | Canada | 2020-06-12 | Business | 416-555-0133 |
| 11 | Daniel Kim | Seattle | USA | 2024-10-03 | Consumer | NULL |
| 12 | Westbrook Dental Clinic | Chicago | USA | 2022-12-01 | Business | 312-555-0164 |
How the course fits a term or a bootcamp
The SQL course has six levels, each ending with a project. You can follow it in order or pick the levels that match your syllabus:
| Level | Topics | Good for |
|---|---|---|
| 1 Getting started | SELECT, WHERE, NULL, ORDER BY, calculations | a first unit on databases |
| 2 Summarizing data | COUNT, GROUP BY, HAVING, CASE WHEN, dates and text | reporting and business courses |
| 3 Joining tables | INNER JOIN, LEFT JOIN, subqueries, EXISTS | relational thinking, keys |
| 4 Advanced queries | CTEs, window functions, LAG and LEAD | data analytics bootcamps |
| 5 Changing data | INSERT, UPDATE, DELETE, CREATE TABLE, keys | computing and developer courses |
| 6 Real work | order of execution, dialects, final project | wrapping up before the final test |
Some tools that work well around the lessons:
- Placement at the start. The free skills assessment shows in 15 minutes where each student stands, so you can see who already brings some SQL.
- Projects as assessments. Each level ends with a project: two larger, realistic tasks that combine everything from that level.
- Career prep for bootcamps. The SQL assessment test runs like a hiring test: twelve tasks in 25 minutes, with results by topic. Good as a mock test before job applications.
Class codes for schools, seats for bootcamps
Teachers can ask for a free class code for one school year. Email info@learnthisnext.com with the name of the school, the class and the number of students. We check every request by hand and then set up the team. Each student creates their own account and joins with the code.
Bootcamps, training providers and companies buy Premium seats through the team plan. The team overview shows, for each person, how many exercises they have solved and how many points they have. Premium covers every subject, today Excel, SQL, VBA, Access and Power BI.
A note on student data
An account needs a name, an email address and a password. Whether your school allows students to sign up for an online learning service, and on what terms, depends on your school's or district's rules. If in doubt, check with whoever handles data protection before you hand out the code.
Frequently asked questions
Which database do the exercises use?
SQLite. SELECT, joins, GROUP BY, INSERT, UPDATE and DELETE are written the same way as in MySQL, PostgreSQL or SQL Server. Differences in individual functions are explained under MySQL vs PostgreSQL vs SQL Server.
Do students need an account?
Not for reading the lessons or for the free exercises. To join a class with a code, each student needs their own free account.
Can I see the model answers before class?
Yes. Every exercise shows its model answer and explanation on request. A student who reveals the answer first gets no points for that exercise, so the points still reflect their own work.
How long does a class need for level 1?
That depends on prior knowledge and pace, so we do not give a fixed number. Level 1 has ten short lessons and a project. Work through one lesson with all its exercises yourself and plan from there.