Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
SQL Bottleneck Analysis
00:00
5 left

SQL Bottleneck Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze warehouse performance by joining orders, inventory, and labor tables to identify bottlenecks and late shipments.

Return one row per warehouse and order date. Treat an order with no shipped date as late when it has a promised ship date. A bottleneck exists when the late rate is at least 50%, inventory shortage exists, or productivity is below 10 units per labor hour.

Output

  1. Columns: warehouse_id, metric_date, total_orders, late_shipments, late_rate, avg_fulfillment_days, shortage_units, units_per_labor_hour, bottleneck_flag
  2. Include every warehouse-date combination with orders, including missing inventory or labor data.
  3. Order by warehouse_id, then metric_date.

Schema

orders
ColumnTypeDescription
order_idPKINTUnique order identifier
warehouse_idVARCHAR(10)Warehouse processing the order
order_dateDATEDate the order was placed
promised_ship_dateDATECommitted shipment date
shipped_dateDATEActual shipment date
item_countINTNumber of items in the order
statusVARCHAR(20)Current order status
inventory
ColumnTypeDescription
inventory_idPKINTUnique inventory snapshot identifier
warehouse_idVARCHAR(10)Warehouse holding the inventory
inventory_dateDATEDate of the inventory snapshot
skuVARCHAR(20)Stock keeping unit
available_unitsINTUnits available to fulfill orders
requested_unitsINTUnits requested for the snapshot
labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
warehouse_idVARCHAR(10)Warehouse where labor was recorded
labor_dateDATEDate labor was recorded
labor_hoursDECIMAL(8,2)Total labor hours
units_pickedINTUnits picked by the labor team
Tablesordersinventorylabor
Interviewer

Your question is SQL 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.