← SQL Operations Cases

Independent practice · SQLite

Find paid orders with unmatched customer IDs

My saved work →

Your work

Active 0:00 · Paused 0s

Show the reference answer
SELECT o.order_id,o.customer_id FROM orders o LEFT JOIN customers c ON o.customer_id=c.customer_id WHERE o.status='paid' AND c.customer_id IS NULL

Order 5 references 99. Cancelled NULL-key order 6 is not paid.