AnalystPath

Heaviest Parcel Shipped Each Day

SQLMediumMid level~15 min

Problem

Table: `Shipments`

```text
+-------------+----------+
| Column Name | Type |
+-------------+----------+
| parcel_id | int |
| ship_ts | datetime |
| weight_kg | int |
+-------------+----------+
parcel_id is the primary key for this table.
Each row describes one parcel: when it left the depot and how much it weighed.
```

A logistics depot wants to flag the heaviest parcel it sent out on each calendar day. If two or more parcels on the same day tie for the highest weight, all of them should be flagged.

Write a solution to report the `parcel_id` of the heaviest parcel(s) shipped on each day.

Return the result table ordered by `parcel_id` in ascending order.

Tables

Example rows — the live problem includes the full dataset.

Shipments
parcel_idship_tsweight_kg
12023-09-01 08:15:0012
22023-09-01 16:40:0030
32023-09-01 11:00:0030

Expected output

Your answer should return 4 rows with the columns parcel_id.

Starter code (SQL)

SELECT *
FROM Shipments;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions