Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Identify Supply Chain Bottlenecks by Delay Rate

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

Your question is Identify Supply Chain Bottlenecks by Delay Rate. Start with the requirements and the three tables 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 shipment data across suppliers, warehouses, and deliveries. Write a PostgreSQL query that identifies the supply chain stages with the highest bottleneck risk by comparing planned and actual dates, then aggregating delay rates by stage. Return only stages with at least 3 shipments and a delay rate above 30%, ordered by delay rate descending.

Schema

shipments
ColumnTypeDescription
shipment_idPKINTPrimary key for each shipment
supplier_idINTReferences the supplier that shipped the goods
warehouse_idINTReferences the warehouse handling the shipment
planned_ship_dateDATEPlanned outbound shipment date
actual_ship_dateDATEActual outbound shipment date, if shipped
stageVARCHAR(50)Supply chain stage name
suppliers
ColumnTypeDescription
supplier_idPKINTPrimary key for each supplier
supplier_nameVARCHAR(100)Supplier display name
warehouses
ColumnTypeDescription
warehouse_idPKINTPrimary key for each warehouse
warehouse_nameVARCHAR(100)Warehouse display name
Tablesshipmentssupplierswarehouses
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results