Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Find Fulfillment Bottlenecks from Timestamps

HardSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Find Fulfillment Bottlenecks from Timestamps. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

You are given fulfillment event timestamps for each order. Write a PostgreSQL query that identifies where the bottleneck is occurring in the fulfillment chain by calculating the elapsed time between consecutive stages for each order and reporting the stage with the largest average delay.

Schema

order_fulfillment_events
ColumnTypeDescription
order_idBIGINTUnique order identifier
event_nameVARCHAR(50)Fulfillment stage name
event_tsTIMESTAMPTimestamp when the stage occurred
store_idINTStore handling the order
Tablesorder_fulfillment_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results