SQL
For engineers
Writing and reading queries, joins, aggregates and indexes, including SQL that an assistant wrote for you
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
A table has 50 rows with a NULL in the column phone. What does SELECT * FROM contacts WHERE phone = NULL return?
Check yourself · 2 of 5
100 customers, 300 orders, each order belongs to exactly one customer. At most how many rows does an inner join on customer_id return?
Check yourself · 3 of 5
A column has 10 rows, 3 of them NULL. What does COUNT(column) return?
Check yourself · 4 of 5
A plan shows 'Seq Scan on orders ... Rows Removed by Filter: 1999982' for a query returning 18 rows. What does it tell you?
Check yourself · 5 of 5
An assistant writes a query that runs without errors. What does that prove?
Topics
- Filtering rows with SELECT and WHERE4 min read · Choosing columns, filtering with WHERE, sorting and limiting, and handling NULL with IS NULL because NULL never equals anything
- Joining tables without losing rows4 min read · Inner versus left joins, join keys, and how duplicate keys multiply rows or a WHERE clause quietly turns a left join into an inner one
- Grouping and totals with GROUP BY4 min read · COUNT, SUM and AVG with GROUP BY, WHERE versus HAVING, COUNT(*) versus COUNT(column), and totals inflated by a join before grouping
- Indexes and reading query plans5 min read · B-tree and composite indexes, column order, when the planner skips an index, and reading EXPLAIN ANALYZE output to find the slow step
- Reviewing SQL an assistant wrote5 min read · Checking queries from Copilot, Cursor, Claude or ChatGPT for wrong join keys, missing tenant filters, string-built input and plausible but wrong totals
Start here
- PostgreSQL tutorial (opens in a new tab)DocsFree
Official walk-through of tables, joins, aggregates and transactions on a small schema.
- SQLBolt: interactive SQL lessons (opens in a new tab)CourseFree
Short browser exercises on filters, joins and aggregates with instant feedback.
- Use The Index, Luke: SQL indexing and tuning (opens in a new tab)BookFree
A free book on how indexes work and how to design them for real queries.
Scenarios
110 questions · last verified 2026-12