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.
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.
Loading the archives...
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 entirely 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 rather than multiple-choice questions. Each chapter practises one construct, from a plain SELECT to a recursive query.
A chapter works the same way every time. You read the story and the objective, then query the archives: police reports, the hotel register, cab rides, telegrams, bank transfers. When you think you have it, you 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.
| 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.
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. For the SQL itself, The Clerk's Handbook explains every construct the chapters use, on a separate example database.
Privacy notice · Statistics · The Clerk's Desk · AlephB · Contact