Play SQL Detective Mystery Online Free

Write SQL queries against a real database to track down a killer in SQL City, then find who was behind the crime.

SQL Detective Mystery title screen on SZ Games
  • Touch: some features

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

Input guide for SQL Detective Mystery
To do thisOn a keyboardWith a mouseOn a touchscreen
Write or change a queryType into the code boxClick within a code boxTap a code box to open the keyboard
Execute the query in a boxShift + EnterClick RunTap Run
Restore the box's original query—Click ResetTap Reset
Open the database diagram—Click the "click here" link above the final code boxTap the "click here" link
See a suggested query (walkthrough page)—Click Show SolutionTap 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:

SQL Detective Mystery – Questions and Answers

Do I need to know SQL already?

It helps, but it is not required. A second walkthrough page explains the basics with runnable examples and optional suggested queries. You can learn there and then return to the case.

Where do I enter my answer?

Type the name into the "Check your solution" box and run it. A wrong name tells you to try again, and the right one opens a second, harder question.

Will the page remember my queries?

No. Notes and results are not saved, so keep a list of names, IDs and dates on paper or in another window while you work.

Try Something Different