Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Bottleneck Analysis
00:00
5 left

SQL for Bottleneck Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by plant and month, joining production, inventory, and shipment tables to identify bottlenecks and late orders at TE Connectivity.

Use the provided production, inventory, and shipment tables. Return one row for every plant-month appearing in any table, including months without production.

Output

  1. Return plant_code, month, production totals, rejection rate, latest inventory quantities, shipment totals, late-order count, prior-month throughput change, and bottleneck_status.
  2. Sort by plant_code, then month ascending.

Schema

production
ColumnTypeDescription
production_idPKINTEGERUnique production record identifier
plant_codeVARCHAR(20)TE Connectivity manufacturing plant code
production_dateDATEDate of the production run
units_producedINTEGERUnits completed during the run
units_rejectedINTEGERUnits rejected during quality inspection
inventory
ColumnTypeDescription
inventory_idPKINTEGERUnique inventory snapshot identifier
plant_codeVARCHAR(20)TE Connectivity manufacturing plant code
snapshot_dateDATEDate of the inventory snapshot
raw_material_qtyINTEGERAvailable raw material quantity
finished_goods_qtyINTEGERAvailable finished goods quantity
shipments
ColumnTypeDescription
shipment_idPKINTEGERUnique shipment identifier
plant_codeVARCHAR(20)Plant responsible for the shipment
order_idVARCHAR(30)Customer order identifier
ship_dateDATEActual shipment date
promised_dateDATEPromised shipment date
units_shippedINTEGERUnits included in the shipment
Tablesproductioninventoryshipments
Interviewer

Your question is SQL for Bottleneck Analysis. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.