Skip to content
mentoor

SQL

For engineers

Writing and reading queries, joins, aggregates and indexes, including SQL that an assistant wrote for you

See where you stand

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?

Choose one answer

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?

Choose one answer

Check yourself · 3 of 5

A column has 10 rows, 3 of them NULL. What does COUNT(column) return?

Choose one answer

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?

Choose one answer

Check yourself · 5 of 5

An assistant writes a query that runs without errors. What does that prove?

Choose one answer

Topics

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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

110 questions · last verified 2026-12