Logistics & Transportation Analytics · Mission 13 of 30Medium

Top 5 most expensive shipments

Compute a derived column, sort descending, and use LIMIT to return top-N

The Brief

Priya KapoorFreight Finance Leadlogistics-ops

I need the 5 most expensive shipments by total cost. Compute `total_cost` as freight_cost + fuel_surcharge + accessorial_cost. Return `shipment_id`, `carrier_id`, `lane_id`, `status`, and `total_cost`. Sort by total_cost descending, limit to 5.

You'll practice

LIMITORDER BYSUM

Tables & columns available

fact_shipmentsfact15 columns
ColumnTypeKey
shipment_idINTPK
carrier_idINTFK → dim_carriers
lane_idINTFK → dim_lanes
planned_pickup_dateTEXT
actual_pickup_dateTEXT
planned_delivery_dateTEXT
actual_delivery_dateTEXT
qty_orderedINT
qty_shippedINT
weight_lbsREAL
freight_costREAL
fuel_surchargeREAL
accessorial_costREAL
dwell_hours_at_originREAL
statusTEXT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Compute the derived column: freight_cost + fuel_surcharge + accessorial_cost AS total_cost.

Hint 2

Sort by total_cost DESC to bring the most expensive rows to the top.

Hint 3

LIMIT 5 caps the result at five rows.