GN Math

SQL Detective Mystery Unblocked

Write real SQL queries to sift police reports, interviews and gym logs until you can name the killer.

now playing: SQL Detective Mystery

There are no suspects to click on and no magnifying glass. Your only detective tool is a query box. Someone was murdered in SQL City on January 15, 2018, and every clue you need sits inside a database of people, licenses, interviews and check-ins. SQL Detective Mystery unblocked turns learning SQL into a case you actually want to close.

The case was written by Northwestern University's Knight Lab, and the database engine runs right inside the page.

How to play SQL Detective Mystery

The page holds a few editable code boxes. Type a query, run it, and a results table shows up below the box. The first examples list the tables in the database and the columns inside one of them, which is how you get your bearings.

Then the trail begins. Pull up the police report for the right date, city and crime type. It names witnesses, and their statements point you toward other tables. Each answer narrows the list of people who could have done it.

Once you have a name, enter it in the solution check box and run it. A wrong guess gets a polite nudge to keep digging. The right answer reveals a second, harder question about who was really pulling the strings.

Controls

To…KeyboardMouseTouch
Type or edit a queryType in the code boxClick inside a code boxTap a code box to bring up the keyboard
Run the query in a boxShift + EnterClick RunTap Run
Put the box back to its starting query—Click ResetTap Reset
Show the database diagram—Click the "click here" link above the last code boxTap the "click here" link
Reveal a suggested query (walkthrough page)—Click Show SolutionTap Show Solution

Tips

  • Open the diagram early. The link above the last code box shows how the tables connect by ID, which saves you from guessing column names.
  • Narrow results with several conditions. Combining date, city and crime type in one WHERE clause shrinks a long report table to a single row.
  • Search for fragments with LIKE. Witnesses describe people loosely, so a pattern such as a partial name or plate works better than an exact match.
  • Let JOIN do the cross-checking. Linking two or three tables in one query is faster and safer than copying IDs by hand.
  • Keep a notepad open. The page does not remember your results, so jot down names and IDs as you find them.

SQL Detective Mystery questions

I have never written SQL. Can I still play?

Yes. A walkthrough page teaches the commands you need, step by step, with boxes you can run. It also has optional Show Solution buttons if you get truly stuck.

Will my queries still be there tomorrow?

No. Everything lives in the open page, so a reload puts every box back to its starting query. Save any queries you like in a text file.

Does it work on a Chromebook?

Yes. It runs in the browser with nothing to install, and a Chromebook keyboard is all you need. Phones work too, but typing long queries on a touch keyboard is slow.

Homework: games like SQL Detective Mystery

all coding games