Loading the editor…
Count shipments in each operational status.
The network standup wants a one-line count of delivered, in-transit, and cancelled freight.
Return status and shipments. Count rows per status. Sort by shipments descending, then status.
| 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: Lead status buckets
Related: Shipments still in transit, Active shipments per warehouse