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_idnamecitycountrycustomer_sincesegmentphone
1Harbor Fremont PartnersBostonUSA2021-03-15Business617-555-0142
2Emily CarterChicagoUSA2022-07-01ConsumerNULL
3Riverside County OfficeRiversideUSA2020-11-20Government951-555-0110
4Raj PatelLeedsUK2023-01-09Consumer0113 496 0123
5Lakeview Hotel LtdManchesterUK2022-04-18Business0161 496 0456
6Olivia BrooksAustinUSA2024-02-27ConsumerNULL
7Greene & Shaw LLPLondonUK2021-09-05Business020 7946 0321
8Maple Grove High SchoolAustinUSA2023-08-14School512-555-0187
9Chloe EvansBostonUSA2025-05-30Consumer617-555-0199
10Northline Printing CoTorontoCanada2020-06-12Business416-555-0133
11Daniel KimSeattleUSA2024-10-03ConsumerNULL
12Westbrook Dental ClinicChicagoUSA2022-12-01Business312-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_idcustomer_idorder_datestatusemployee_id
100112026-01-08delivered3
100242026-01-12delivered4
100332026-01-20delivered3
100472026-02-03delivered4
100522026-02-11cancelled8
100612026-02-25delivered3
1007102026-03-04delivered2
100852026-03-17delivered4
100982026-03-30delivered3
101062026-04-07delivered8
1011122026-04-22delivered4
101232026-05-06delivered3
101392026-05-19cancelled8
101472026-06-02shipped4
101512026-06-10shipped3
1016112026-06-12openNULL
101742026-06-13openNULL
1018102026-06-14openNULL
customers 12 rows, 7 columns
customer_idnamecitycountrycustomer_sincesegmentphone
1Harbor Fremont PartnersBostonUSA2021-03-15Business617-555-0142
2Emily CarterChicagoUSA2022-07-01ConsumerNULL
3Riverside County OfficeRiversideUSA2020-11-20Government951-555-0110
4Raj PatelLeedsUK2023-01-09Consumer0113 496 0123
5Lakeview Hotel LtdManchesterUK2022-04-18Business0161 496 0456
6Olivia BrooksAustinUSA2024-02-27ConsumerNULL
7Greene & Shaw LLPLondonUK2021-09-05Business020 7946 0321
8Maple Grove High SchoolAustinUSA2023-08-14School512-555-0187
9Chloe EvansBostonUSA2025-05-30Consumer617-555-0199
10Northline Printing CoTorontoCanada2020-06-12Business416-555-0133
11Daniel KimSeattleUSA2024-10-03ConsumerNULL
12Westbrook Dental ClinicChicagoUSA2022-12-01Business312-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:

LevelTopicsGood for
1 Getting startedSELECT, WHERE, NULL, ORDER BY, calculationsa first unit on databases
2 Summarizing dataCOUNT, GROUP BY, HAVING, CASE WHEN, dates and textreporting and business courses
3 Joining tablesINNER JOIN, LEFT JOIN, subqueries, EXISTSrelational thinking, keys
4 Advanced queriesCTEs, window functions, LAG and LEADdata analytics bootcamps
5 Changing dataINSERT, UPDATE, DELETE, CREATE TABLE, keyscomputing and developer courses
6 Real workorder of execution, dialects, final projectwrapping 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.

Start with your class

Have a look at level 1 of the SQL course. It is free and works well as the first unit on databases. A short email is all it takes to get a class code.

Go to the SQL course See the team plan

Write to us

Choose language

Select your preferred language