Customers Who Never Ordered
The marketing team wants to re-engage registered customers who have never placed an order.
Find every customer in customers with no row in orders.
Return columns customer_id, name. Row order does not matter.
Schema
CREATE TABLE customers ( customer_id INTEGER PRIMARY KEY, name TEXT NOT NULL, signup_date TEXT NOT NULL ); CREATE TABLE orders ( order_id INTEGER PRIMARY KEY, customer_id INTEGER NOT NULL, amount REAL NOT NULL );
Sample data
customers
| customer_id | name | signup_date |
|---|---|---|
| 1 | Omar Siddiqui | 2025-11-02 |
| 2 | Priya Shah | 2025-11-15 |
| 3 | Quinn Murphy | 2025-12-01 |
| 4 | Rosa Alvarez | 2026-01-09 |
| 5 | Sami Yousef | 2026-01-20 |
orders
| order_id | customer_id | amount |
|---|---|---|
| 100 | 1 | 45 |
| 101 | 1 | 99.9 |
| 102 | 3 | 12.5 |
| 103 | 5 | 230 |
Hint 1
A LEFT JOIN keeps every customer, filling the order columns with NULL when there is no match.
Hint 2
NOT EXISTS with a correlated subquery works too.
Good practice for: Data Analyst, Backend Developer, Digital Marketing Specialist, Business Analyst
SQL (SQLite)
Run checks your query on the sample data (Ctrl + '). Submit also checks hidden databases.