Chapter 9 · Interview Level
14. Average Days to Ship by Status
Medium20 XPE-Commerce
Calculate the average number of days between order_date and shipping_date for each order status. Only consider orders that have a shipping record. Return the order status, average days to ship (rounded to 1 decimal), and the count of orders, sorted by average days to ship (fastest first).
Tables
- PKidINT
- FKcustomer_id→ customers.idINT
- order_dateTEXT
- statusTEXT
- total_amountREAL
- 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.