SQL Detective Mystery turns a database into a crime scene. A murder took place in SQL City on January 15, 2018, and you only remember that a crime scene report exists. To learn more, you must write SQL queries against a set of tables. Witness statements, driver’s licenses and gym check-ins are all in there. Everything runs inside the page, so no install is needed.
How the Case Works
The page has several code boxes. Each box starts with a sample query that you can change and run. The results show up as a table below it. The first boxes show you how to list the tables and how to see the columns in one of them.
Start by finding the right report. Filter by date, city and type of crime. The report names witnesses, and you can look them up in the person and interview tables. What they say points you to other tables, and each answer narrows the list of suspects.
How to Control SQL Detective Mystery
| To do this | On a keyboard | With a mouse | On a touchscreen |
|---|---|---|---|
| Write or change a query | Type into the code box | Click within a code box | Tap a code box to open the keyboard |
| Execute the query in a box | Shift + Enter | Click Run | Tap Run |
| Restore the box's original query | — | Click Reset | Tap Reset |
| Open the database diagram | — | Click the "click here" link above the final code box | Tap the "click here" link |
| See a suggested query (walkthrough page) | — | Click Show Solution | Tap Show Solution |
When you have a name, enter it in the answer box. The right name unlocks a bonus step that asks who really planned the crime.
What You Are Working With
The database is real SQLite and fairly large. It holds about 10,000 people and 1,228 crime scene reports, plus thousands of interviews, licenses and check-ins. A diagram, opened from a link above the last box, shows how the tables connect by ID.
Query Habits That Help
- Open the diagram before you start. It saves a lot of guessing.
- Use WHERE to cut big tables down to a few rows.
- Use LIKE with % when you know only part of a name.
- Combine ORDER BY, DESC and LIMIT 1 to find the highest or last value.
- Use JOIN to link tables in one query instead of copying IDs by hand.
- Write down each clue as you find it.
Who Will Enjoy It
The case suits students learning SQL, developers who want a fun refresher and anyone who likes detective stories. Each query feels like asking a witness a question. If you like learning code through play, try CSS Diner or the other puzzle games here.
Last played and checked by SZ Games:













