Beginner
Case 7 of 50
Case 007: The Customers Who Never Ordered
customersorders
"Some people sign up and we just never hear from them again,"
the manager says. "Could you find out who they are? I'd like to get a sense of how many signups just go quiet."
The data Alex is looking at
customers
| id | name | country |
|---|---|---|
| 1 | Sam | Germany |
| 2 | Nina | Canada |
| 3 | David | Brazil |
| 4 | Maya | Japan |
| 5 | Daniel | Australia |
| … 1 more row | ||
orders
| id | customer_id | product | amount | order_date |
|---|---|---|---|---|
| 101 | 1 | Keyboard | 2500 | 2026-01-05 |
| 102 | 3 | Mouse | 1200 | 2026-01-08 |
| 103 | 2 | Headphones | 3500 | 2026-01-10 |
| 104 | 4 | Monitor | 12000 | 2026-01-12 |
| 105 | 1 | Webcam | 4500 | 2026-02-03 |
| … 4 more rows | ||||
TASK
Help Alex answer the manager:
“Find every customer who has never placed a single order.”
Write a query above and hit Run to see what comes back.
No hints requested yet — click "Get a hint" when you're stuck.
Alex's final query — this is for reference. Copy it into your own thinking, not into the editor above.
SELECT customers.name
FROM customers
LEFT JOIN orders ON customers.id = orders.customer_id
WHERE orders.id IS NULL;
What that query returns
Case Debrief
LEFT JOIN, IS NULL
- LEFT JOIN customers to orders keeps every customer, even ones with no matching order. For a customer like Daniel or Lily who never ordered, every order column — including orders.id — comes back as NULL instead of the row just disappearing.
- WHERE orders.id IS NULL then keeps only those rows: the customers whose order columns never got filled in, because they never placed an order at all.
- Quick tip: RIGHT JOIN is the mirror image of LEFT JOIN — it keeps every row from the right-hand table instead of the left. So orders RIGHT JOIN customers would keep every customer, the same way this case's customers LEFT JOIN orders does. FULL OUTER JOIN keeps every row from both tables at once, filling in NULL wherever a match is missing on either side.