Loading problem...
Your commerce analytics team maintains two relational tables:
Build a report that returns every customer who has never placed an order.
Output requirements:
This problem must be solved for:
Customers:
| id | name |
|----|-------|
| 1 | Joe |
| 2 | Henry |
| 3 | Sam |
| 4 | Max |
Orders:
| id | customerId |
|----|------------|
| 1 | 3 |
| 2 | 1 |[
{"Customers":"Henry"},
{"Customers":"Max"}
]Customers 2 and 4 do not appear in Orders.customerId, so they are returned.
Customers:
| id | name |
|----|-------|
| 10 | Ana |
| 11 | Omar |
Orders:
| id | customerId |
|----|------------|
| 90 | 10 |
| 91 | 10 |[
{"Customers":"Omar"}
]Multiple orders from the same customer still mean that customer is active. Only customer 11 has no order.
Customers:
| id | name |
|----|--------|
| 7 | Priya |
| 8 | Arjun |
Orders:
| id | customerId |
|----|------------|
| 1 | null |
| 2 | 8 |[
{"Customers":"Priya"}
]A null customerId in Orders does not match any customer. Only customer 8 has a valid order reference.
Constraints