A FREE GAME TO LEARN SQL
A calling card signed A. L. was found on the pillow of the Comtesse de Cagliostro.
Inspector Ganimard, summoned in the night, has promised an arrest before the week is out. He has also, we are told, hired a clerk.
You are the clerk. Your only weapon is SQL.
Loading the archives...
New to SQL? Try a two-minute warm-up first →
, as
Waiting for the teacher to open the session. Keep this page open: the clock starts for everyone at once.
The Ritz Affair is a detective story you play by writing SQL. Paris, May 1912: the Blue Star, a famous sapphire, has vanished from the Hotel Ritz, and Inspector Ganimard needs a clerk who can read his archives. The archives are a SQLite database that runs in your browser. There is nothing to install and no account to create, and in learning mode nothing you type is sent to a server.
It is written for students of a first SQL course, and for teachers who want a graded or timed class session built on real queries instead of multiple-choice questions.
How a chapter works
You read the story and the objective, then query the archives: police reports, the hotel register, cab rides, telegrams, bank transfers. Your first query is already waiting in the terminal:
SELECT * FROM interview LIMIT 5;
When you think you have it, type the answer. A correct answer opens the next chapter and reveals its tables in the schema beside the terminal. In learning mode a wrong one costs nothing but pride. Once a chapter is solved, its review shows how it's done, with the reference SQL.
The twelve chapters (each construct links to its lesson in the handbook)
| Chapter | SQL practised |
|---|---|
| I. The Night of the 17th | SELECT / WHERE |
| II. The Neighbouring Suite | ORDER BY / LIMIT |
| III. A Plate in the Dark | LIKE |
| IV. The Cab's Week | GROUP BY / HAVING |
| V. The Boarding House | JOIN |
| VI. Follow the Francs | three JOINs, SUM and HAVING |
| VII. The Quietest Hour | CASE WHEN with GROUP BY |
| VIII. The First Order Before Dawn | RANK() OVER and a CTE |
| IX. The Trunk | CTE and JOIN |
| X. Never Seen Together | self-join |
| XI. The Silence | LAG() OVER |
| XII. Follow the Money | WITH RECURSIVE |
After chapter VIII the paper switches to its night edition: Part II follows the case after dark through four more chapters and new tables.
In compete mode a teacher hands out a season link; each player picks a pseudo, the teacher starts every clock at once, and a class leaderboard ranks everyone by time.
Learn the SQL first
The Clerk's Handbook explains every construct the chapters use, on a separate bakery database, with twenty-three graded exercises you can run in the page and the grammar of SQL in one place.
The story borrows Arsene Lupin, Ganimard, the Comtesse de Cagliostro and the names Sernine and Velmont from Maurice Leblanc. Everyone else in the archives is invented, and every name, sum and timetable in the database is fictional. The jokes hidden among its rows are deliberate.
Privacy notice · Statistics · The Clerk's Desk (teachers) · AlephB · Contact