Advanced Case 41 of 50

Case 041: The Cross-Sell Opportunity

customersordersorder_itemsproducts

The Audio team is planning an upsell push and wants a list of people worth targeting — not random customers, people already primed to buy.

The manager passes along their ask: "Could you find everyone who's bought Accessories from us but never once bought from Audio? Those are our best upsell targets."

The data Alex is looking at

customers
idnamecountrysignup_date
1SamGermany2026-01-02
2NinaCanada2026-01-05
3DavidGermany2026-01-10
4MayaJapan2026-01-15
5DanielCanada2026-01-20
… 5 more rows
orders
idcustomer_idorder_date
10112026-01-05
10222026-01-08
10332026-01-12
10412026-01-20
10542026-02-01
… 23 more rows
order_items
order_idproduct_idquantity
10112
10121
10231
10323
10451
… 29 more rows
products
idnamecategoryprice
1KeyboardAccessories2500
2MouseAccessories1200
3HeadphonesAudio3500
4MonitorDisplays12000
5LaptopComputers60000
… 5 more rows
TASK

Help Alex answer the manager:

“Find every customer who has bought from the 'Accessories' category but has never bought from the 'Audio' category.”
SQL editor Ctrl+Enter to run
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 WHERE customers.id IN ( SELECT orders.customer_id FROM orders JOIN order_items ON order_items.order_id = orders.id JOIN products ON products.id = order_items.product_id WHERE products.category = 'Accessories' EXCEPT SELECT orders.customer_id FROM orders JOIN order_items ON order_items.order_id = orders.id JOIN products ON products.id = order_items.product_id WHERE products.category = 'Audio' );
What that query returns
Case Debrief EXCEPT (set difference)
  • EXCEPT is the set-difference operator: first-query-only, nothing from the second — exactly the shape of "bought this, but never that."

Case closed.

Ready for the next one?

Next: Case 042 — New, Returning, or Loyal →