Chapter 4 · Aggregations
49. Average Shipping Duration by Carrier
Medium20 XPE-Commerce
Calculate the average number of days between shipping_date and delivery_date for each carrier. Only include shipments that have been delivered (delivery_date IS NOT NULL). Round to 1 decimal place and sort by average days ascending.
Tables
- PKidINT
- FKorder_id→ orders.idINT
- shipping_dateTEXT
- delivery_dateTEXT
- carrierTEXT
- tracking_numberTEXT
- statusTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.