180 SQL interview questions. Every answer was run.
An e-book for the SQL round of a data analyst, data scientist, data engineer or AI engineer interview. Each answer shows the rows the database returned. 168 of the 180 also show the classic wrong query.

PDF (369 pages), EPUB and MOBI. Paid once, plus VAT where it applies. You can ask for a refund within 30 days.
Get the book for $19Not sure yet? Read 30 of the 180 questions free first (76-page PDF, no e-mail asked).
What is inside
180 questions in 12 chapters
Filtering, aggregates, joins, NULLs, subqueries, CTEs and recursion, window functions, dates, strings, set operations, and the questions interviewers ask aloud.
The answer and its output
Every answer was run on PostgreSQL 16 and on a second database engine, with the same rows. The table under each answer is what the database returned, so you can check your own rows against it.
The classic mistake
168 of the 180 questions also print the classic wrong query, with the rows it returns and why they are wrong. You meet the mistake at home first.
How to think about it
A short explanation in the order an interviewer wants to hear it.
One small shop database
All 180 questions are set in one shop database of nine tables. The book prints every row and the script that builds them, so you can run everything yourself.
Three levels
Each question is marked easy, medium or hard.
Get it
Free sample
$030 of the 180 questions with their answers, from all 12 chapters. A 76-page PDF. No e-mail needed.
Download freeThe full e-book
$19All 180 questions. PDF (369 pages), EPUB and MOBI. Paid once, plus VAT where it applies. You can ask for a refund within 30 days.
Buy for $19How to use it
- Read the question and write your own query first.
- Compare your rows with the printed output.
- Read the explanation, then run the classic mistake and see what it returns.
- The week before the interview, do the hard questions again with a clock.
Sold through Gumroad. You can ask for a refund within 30 days.
Disagree with an answer? Write to [email protected]. If you are right, we fix it in the next edition.