Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return c.customer_id, c.country, and c.created_at for customers who have no rows in orders. Order by customer_id.
Result columns · in this order
customer_id | Stable customer identifier. |
country | Customer country. Can be NULL when unknown. |
created_at | Order timestamp (YYYY-MM-DD HH:MM:SS). |
How to approach it
LEFT JOIN orders, then WHERE o.order_id IS NULL keeps customers with no match.
Sample input
| customer_id | country | created_at |
|---|---|---|
| 1 | US | 2025-11-02 |
| 2 | null | 2025-12-10 |
| 3 | GB | 2026-01-05 |
| 4 | IN | 2026-01-09 |
| 5 | US | 2025-10-01 |
| 6 | GB | 2026-01-15 |
6 rows — all rows shown.
| order_id | buyer_id |
|---|---|
| 1001 | 1 |
| 1002 | 3 |
| 1003 | 4 |
| 1005 | 2 |
| 1006 | 6 |
5 rows — all rows shown.
Expected output
| customer_id | country | created_at |
|---|---|---|
| 5 | US | 2025-10-01 |
1 row — all rows shown.
Constraints
LEFT JOIN customers to orders on orders.buyer_id = customers.customer_id, then keep only rows where orders.order_id IS NULL (the anti-join). Do not filter the right table in a way that drops the unmatched rows.
Expected skills
LEFT JOIN to preserve all customers and the anti-join pattern (IS NULL on the right key) to keep only unmatched rows.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.