15 SQL Interview Questions (With How to Practice Each)

Common SQL interview questions — JOINs, GROUP BY, NULLs, duplicates, windows — each paired with a free interactive exercise you can run in your browser.

orders order_id customer_id ← status JOIN customers → customer_id first_name city row
A JOIN stitches tables together using a shared key (here: customer_id).

Warm-up (they still ask these)

  1. Select specific columns — not SELECT * in production stories. Practice: SELECT columns.
  2. Filter with WHERE — equality, ranges, AND/OR. Practice: WHERE city.
  3. Sort and take top N — ORDER BY + LIMIT. Practice: top products.
  4. DISTINCT vs GROUP BY — unique values vs counts. Guides: DISTINCT, GROUP BY.

JOIN questions (the make-or-break section)

  1. INNER JOIN customers to orders — who bought something? Practice: INNER JOIN.
  2. INNER vs LEFT JOIN — who disappears? Guide: INNER vs LEFT.
  3. Customers with no orders — anti-join / NOT IN / NOT EXISTS. Guide: anti-join.
  4. LEFT JOIN + WHERE trap — why unmatched rows vanish. Guide: WHERE after LEFT JOIN.
  5. Multi-table join — orders → items → products. Practice: triple join.

Deep dive: SQL JOIN interview questions.

Aggregation & business metrics

  1. Count rows vs count non-nulls — COUNT(*) vs COUNT(col). Guide: COUNT(*).
  2. GROUP BY city / category — one row per group. Practice: GROUP BY city.
  3. HAVING vs WHERE — filter groups, not rows. Guide: HAVING vs WHERE.
  4. Find duplicates — GROUP BY + HAVING COUNT > 1. Guide: find duplicates.

Senior / analytics follow-ups

  1. CASE WHEN buckets — label rows for reporting. Practice: CASE WHEN.
  2. RANK / ROW_NUMBER — top item per group. Guide: window RANK · Practice: rank by price.

Prep path if you’re starting from scratch: SQL interview prep order.

FAQ

What are the most common SQL interview questions?

INNER vs LEFT JOIN, customers with no orders, GROUP BY + HAVING, finding duplicates, NULL vs IS NULL, and ranking with window functions. Almost every screen hits at least two of these.

How do I practice SQL interview questions online for free?

Use a site with a real editor and a fixed sample database. SQL Practices lets you run the same Northstar Market drills that match these interview patterns — no install.

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice a classic JOIN question

Related guides