SQL JOIN Interview Questions (INNER, LEFT, Anti-Join)
The JOIN questions that show up in SQL interviews — INNER vs LEFT, no-match rows, fan-out — with shop examples and free practice drills.
Question 1 — “Join customers to their orders”
Classic warm-up. They want to see the ON key and table aliases.
SELECT c.first_name, o.order_id, o.status FROM customers c INNER JOIN orders o ON c.customer_id = o.customer_id;
Practice: INNER JOIN drill. Theory: JOIN explained.
Question 2 — “Who never ordered?”
This separates people who only memorized INNER JOIN. Patterns that work:
LEFT JOIN … WHERE o.order_id IS NULLNOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.customer_id)NOT IN— careful with NULLs
Walkthrough: anti-join / NOT IN.
Question 3 — “INNER vs LEFT — when?”
Say it in one breath: INNER when you only want complete matches; LEFT when the left table is the universe you must keep (all customers, even zero-order).
Full comparison: INNER JOIN vs LEFT JOIN.
Question 4 — “Why did my LEFT JOIN look like an INNER?”
Almost always: a filter on the right table in WHERE (e.g. o.status = 'paid') drops the NULL-extended rows. Move that predicate into ON if you still need unmatched left rows.
Guide: LEFT JOIN + WHERE trap. Practice: JOIN + filter.
Question 5 — “My totals exploded after a JOIN”
One-to-many joins multiply rows (one order → many line items). Summing an order-level column after that fan-out double-counts. Aggregate the many-side first, or use COUNT(DISTINCT …) when appropriate.
Guide: JOIN row multiplication. Multi-hop practice: line items join.
How to answer out loud
Name the grain → name the tables → pick INNER or LEFT → write ON keys → filter → aggregate. Interviewers listen for that sequence more than for perfect punctuation.
More prompts: 15 SQL interview questions · prep plan: SQL interview prep.
FAQ
What JOIN questions are asked in SQL interviews?
Expect INNER vs LEFT JOIN, listing rows with no match (customers without orders), filtering correctly after a LEFT JOIN, and explaining why a JOIN duplicated rows.
How do I explain INNER JOIN vs LEFT JOIN in an interview?
INNER JOIN keeps only matching pairs. LEFT JOIN keeps every left-table row and fills NULLs when the right side has no match. Say which table you refuse to drop.
Try it yourself
The fastest way to lock this in is a short drill on the same Northstar Market tables.