Play Next
View all →About this game
SQL Detective turns database queries into a block building puzzle. Every case is one line of crime plus one to three data tables of suspects, loot and visits. Columns and tables keep the plain English names of real SQL, and the rows are emoji, numbers and short names, so nothing needs translating between languages. Tap or drag blocks from the tray into a two line query area: SELECT a column or COUNT, FROM a table, WHERE a condition, then AND or OR to cross-check, ORDER BY with ASC or DESC, LIMIT for the top rows. Press Run and watch filtered rows sink into gray while the culprit row pulses amber. The page runs the same SQL subset engine that a build time verifier used to prove all 24 campaign cases and 365 seeded daily cases: the reference query lands on exactly one answer, dropping any WHERE condition breaks that uniqueness, and no shorter block sequence can do it either. Stars are a double metric on block count, three within the reference, two with up to two extra blocks, one for closing the case, and three wrong picks cap it at one. Four chapters teach the single filter, the cross check, the sorted top pick and the aggregation plus two table join. A new seeded case opens at UTC midnight with a spoiler free share card. Unlike long text detective games, this one reasons purely over structured tables.
How to play
Tap blocks in the tray to build the query in the sheet, press Run, then tap the row that names the culprit, or let a matching count or aggregate value close the case. Fewer blocks earn more stars.
Tips & Tricks
- The header shows the reference block count: three stars need no more blocks than that and a result that holds the answer alone.
- A result with other suspects still in it wins the case but pays only one star, so keep adding conditions until the table narrows to the culprit.
- In two table cases, run the query on the second table first, the id it reveals appears as a fresh block for the suspects table.
- LIMIT only works right after ORDER BY, so sort before you take the top row.
Frequently asked questions
Do I need to know SQL?
No. Every keyword lives on a block and the first two cases of each chapter guide you in three steps. When you finish, the block order will feel exactly like the way a database reads a real query.
How are the case answers guaranteed unique?
All 24 campaign cases and all 365 seeded daily cases are executed at build time against the same query engine that runs in the page. The verifier checks that the reference query lands on one answer, that removing any WHERE condition makes the result ambiguous again, and that no shorter block combination reaches the same result.