Logistics & Transportation Analytics · Mission 5 of 30Starter

Status breakdown

GROUP BY a categorical column with COUNT(*), sorted by count descending

The Brief

Maya ChenLogistics Analystlogistics-ops

I want the full status breakdown for `fact_shipments`. Group by `status`, count rows per group, label the count `shipment_count`, and sort largest to smallest. Should be three rows.

You'll practice

GROUP BYORDER BYCOUNT

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

Use GROUP BY status to partition rows by status value.

Hint 2

COUNT(*) inside the SELECT counts rows per group.

Hint 3

ORDER BY shipment_count DESC puts the largest group first.