Interview practice question
Measuring time spent in each order status
Data Analyst · SQL for Analytics · Intermediate
You have a status history table with one row per status change. How do you calculate how long orders spend in each status?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- LEAD(changed_at) per order = next status time.
- Duration = next − current.
- Last status open-ended (use now or exclude).
- Aggregate median/avg per status.
- Find bottlenecks.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.