Home / SQL / Practice problems / Medium

Customers who never ordered

Medium

Show the name of every customer with no orders at all.

Tables: customers(customer_id, name, city, country, joined) · products(product_id, name, category, price) · orders(order_id, customer_id, order_date, status) · order_items(order_id, product_id, quantity, unit_price)

Your query
Show the expected result
name
Noah Brown
Kiran Rai
Anjali Karki

3 rows

Show a solution
SELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.customer_id WHERE o.order_id IS NULL;

SQL used

New to SQL? The free SQL course teaches everything these problems use, with a self-checking exercise in every lesson.