Skip to content
>_sqlbuddy

SQL interview preparation

SQL Interview Questions and Answers

36 hand-written SQL interview questions that run against a real SQLite database in your browser. No sign-up, no server — read the problem, write your query, and get instant pass/fail feedback with edge-case fixtures. 16 easy, 19 medium, 1 hard.

Start practicing

Why practice here?

  • Every query runs against a real SQLite database — compiled to WebAssembly, entirely in your browser.
  • Answers are validated against hidden fixtures with edge cases: duplicates, NULLs, and ties.
  • Each question page explains the schema, sample data, and a reference solution.
  • Concepts are organized into topics, so you can learn the pattern behind the question.

From beginner to advanced

The catalogue is ordered easy → hard, so the curve stays gentle. Here is what each level looks like.

Beginner — fundamentals

SELECT, WHERE, NULL handling, and first GROUP BY queries. Get comfortable reading a schema and writing a clean query.

Intermediate — joins, aggregation, windows

Self joins, subqueries, HAVING, and the window functions that dominate real interviews: ranking, running totals, LAG/LEAD.

Advanced — multi-step patterns

Questions that combine CTEs, window functions, and careful edge-case handling — the kind that decide senior-level rounds.

View the full catalogue

By topic

Every question belongs to a topic with its own explanation, syntax, and common mistakes.

Guides

Interview preparation guides

Frequently asked questions

Which SQL topics should I prepare for interviews?
Start with SELECT/WHERE and NULL handling, then GROUP BY, HAVING, and JOINs. At the intermediate level, self joins, subqueries, CTEs, and window functions (ranking, running totals, LAG/LEAD). Advanced rounds add gaps-and-islands, pivots, and multi-step CTE problems.
Do I need to install anything?
No. SQLBuddy runs a real SQLite database in your browser via WebAssembly — queries execute locally, nothing is installed, and there is no sign-up.
Are the answers validated against edge cases?
Yes. Each submission runs against hidden fixtures designed around the question's edge cases — duplicates, NULLs, ties, and empty results — and passes only when your output matches the reference on every one.