Loading the editor…
Find products whose stock has not been recorded.
A preorder camera is in the catalog before inventory receipt. The receiving team needs SKUs where stock is unknown, not SKUs that are simply sold out.
Return id, name, and category for products where stock is NULL. Sort by id. Do not include products with stock zero.
| id | name | city | country | created_at | |
|---|---|---|---|---|---|
| 1 | Alice Chen | alice@northwind.io | Berlin | Germany | 2023-01-12 |
| 2 | Ben Okonkwo | ben@okonkwo.co | Lagos | Nigeria | 2023-03-02 |
| 3 | Clara Singh | clara@singh.dev | London | United Kingdom | 2022-11-20 |
| id | name | category | price_cents | stock |
|---|---|---|---|---|
| 1 | Trail Bottle | Outdoors | 2400 | 120 |
| 2 | Desk Lamp | Home | 4250 | 40 |
| 3 | Noise-canceling Headphones | Electronics | 18900 | 15 |
| id | customer_id | status | ordered_at | shipped_at |
|---|---|---|---|---|
| 1 | 1 | paid | 2024-11-02 | 2024-11-04 |
| 2 | 1 | paid | 2024-12-14 | 2024-12-16 |
| 3 | 3 | shipped | 2025-01-09 | 2025-01-11 |
| id | order_id | product_id | quantity | unit_price_cents |
|---|---|---|---|---|
| 1 | 1 | 1 | 2 | 2400 |
| 2 | 1 | 4 | 1 | 1200 |
| 3 | 2 | 3 | 1 | 18900 |
| id | order_id | method | amount_cents | paid_at | status |
|---|---|---|---|---|---|
| 1 | 1 | card | 6000 | 2024-11-02 | succeeded |
| 2 | 2 | card | 18900 | 2024-12-14 | succeeded |
| 3 | 3 | paypal | 22000 | 2025-01-09 | succeeded |
Ctrl or Cmd + Enter runs the query. The database resets on every run.
Run the query to see rows from the sample database.
Next exercise: Hires since 2023
Related: Products still on the shelf, Distinct product categories