Loading the editor…
Show the three shipments that were delivered most recently.
The control tower reviews the latest proof-of-delivery events at the start of the shift. In-transit freight is a different queue.
Return id, destination_city, and delivered_on for shipments whose status is delivered. Put the latest delivered_on first and keep three rows.
| 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: Failed and refunded payments
Related: Shipments still in transit, Days from ship to delivery