Play free SQL arcade Daily trap SQL traps Blog Teachers Full game
For teachers · 50 minutes
← Ready-to-teach lessons
SELECT and WHERE lesson
A first SQL class in 50 minutes: from the arcade to writing filters with AND, OR and exact text. With a printable worksheet.
Goal
Every student can ask for columns, filter rows with one or more conditions and sort the result.
Lesson plan
0–5 min Introduce the topic on the board with one example query.
5–20 min Arcade , in pairs or alone. Arcade world 1: The Scanner, Query Invaders, Double Cannon and the boss, The NULL Ghost.
20–35 min Worksheet : six questions on the same tables.
35–45 min Case: Case 00, "The First Query": one table, one WHERE and a time.
45–50 min Class discussion with the questions below. Whoever beat the boss hands in their certificate code.
Materials
Mistakes you'll see
Double quotes or no quotes around text. Text goes in single quotes, written exactly as it appears in the table.Comparing with = NULL. It throws no error and returns zero rows: that's the world boss's trap. see the explanation → WHERE before FROM. Word order matters. It helps to write the skeleton on the board.
For the class discussion
Why does age > 40 AND city = 'Salt Harbor' return fewer rows than with OR? What does LIMIT 3 return without ORDER BY, and why can't it answer "the three oldest"? How is NULL like an empty cell, and how is it not?
Evidence
When a student beats a boss, the arcade gives a certificate with a code. Ask for it as the submission and check it here: check codes →
Student worksheet
Ready to print, no answers.
Name: ______________________________ Date: ____________
SELECT and WHERE lesson
suspects id name age city job
1 Lucía Prado 34 Lumen Bay photographer 2 Joel Ibarra 52 Salt Harbor locksmith 3 Marta Solís 27 Lumen Bay nurse 4 Iker Vela 41 San Ciro taxi driver 5 Rocío Andrade 63 Salt Harbor jeweler 6 Damián Cuevas 19 San Ciro courier 7 Elena Ruiz 46 Lumen Bay accountant 8 Bruno Paz 38 Salt Harbor mechanic
The name and city of every suspect.
All columns for suspects older than 40.
The name of those who live in Salt Harbor.
The name of those who live in Salt Harbor and are under 50.
The name of those who live in Lumen Bay or San Ciro.
The name and age of the three oldest suspects, oldest first.
casoabiertogame.com · SQL arcade and detective cases, free for the classroom
Want the answer key?
The worksheet answers and the solutions to all 28 cases aren't published, so students won't find them. Write to us from your institutional email and we'll send them, at no cost.
Request the answer key
The arcade, the lessons and the first two cases are free and need no account. For your group to have all 28 cases, the classroom license is free too: how to request it →