Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Identify Supply Chain Bottlenecks by Delay Rate

MediumSQL · PostgreSQL00:00
I
Practice interviewer
Your interviewer
In session
I
Interviewer

Welcome to the SQL screen.

The question is on your right: Identify Supply Chain Bottlenecks by Delay Rate. Read through the requirements and the three tables first.

Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?

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