task Missing relationships / anti-joins · easy
Items nobody has ordered
Return the id and name of catalog items that appear on no order line.
what to return
- Columns
idnamein this order- Rows
- 1 row · any order
- Watch for
- Any order line counts, whatever the order's status.
- Skill
- Find rows with no match in another table. Refresher: Keep unmatched rows →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result1 row · any order
| id | name |
|---|---|
| 13 | Wall Clock |
all 1 rows
data you can query
Sample rows from each table. Each column shows its type underneath; → marks a link to another table.
catalog_items4 columns · 13 rows
| idinteger · key | nametext | categorytext | pricereal |
|---|---|---|---|
| 1 | Desk Lamp | Lighting | 39 |
| 2 | Floor lamp | Lighting | 89 |
| 3 | String Lights | Lighting | 19.5 |
| 4 | Chef Knife | Kitchen | 59 |
| 5 | Cast Iron Pan | Kitchen | 45 |
showing 5 of 13 rows
order_lines4 columns · 48 rows
| order_idinteger → sales_orders | item_idinteger → catalog_items | quantityinteger | unit_pricereal |
|---|---|---|---|
| 101 | 1 | 1 | 39 |
| 101 | 3 | 2 | 19.5 |
| 102 | 4 | 1 | 59 |
| 103 | 5 | 1 | 45 |
| 103 | 10 | 3 | 12 |
showing 5 of 48 rows
solution.sql
Hints and the answer are always available. Using them counts the question as solved with help.