Loading the editor…
Count shipments per warehouse, excluding cancelled freight.
Network planning wants volume that the warehouse actually processed. Cancelled labels should not inflate the count.
Return warehouse and shipments. Count non-cancelled shipments. Keep every warehouse. Sort by shipments descending, then warehouse name.
| id | name | city |
|---|---|---|
| 1 | Berlin Hub | Berlin |
| 2 | Lagos DC | Lagos |
| 3 | Rotterdam Port | Rotterdam |
| id | warehouse_id | destination_city | status | shipped_on | delivered_on |
|---|---|---|---|---|---|
| 1 | 1 | Paris | delivered | 2025-01-04 | 2025-01-06 |
| 2 | 1 | Warsaw | in_transit | 2025-02-11 | NULL |
| 3 | 2 | Accra | in_transit | 2025-02-12 | NULL |
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: Employees and their managers
Related: Shipments still in transit, Enrollment counts by course