Customers with zero orders
SQL
Medium
4 views
Problem Description
List customers who never placed any order. You can solve using LEFT JOIN + NULL check (or NOT EXISTS).
Constraints
Think: unmatched rows in LEFT JOIN have NULLs
Official Solution
SELECT c.customer_id, c.name FROM Customers c LEFT JOIN Orders o ON o.customer_id = c.customer_id WHERE o.order_id IS NULL;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!