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 for Production Bottleneck Analysis
00:00
5 left

SQL for Production Bottleneck Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze production efficiency by plant, shift, and week, joining production output and downtime tables to identify the top bottlenecks.

Calculate production totals, planned units, downtime minutes, efficiency percentage, and prior-week downtime. Include unmatched production or downtime groups, and identify the two highest-downtime groups per plant.

Output

  1. One row per selected plant, shift, and week.
  2. Columns: plant_name, shift_name, week_start, total_units_produced, planned_units, total_downtime_minutes, efficiency_pct, prior_week_downtime_minutes, and bottleneck_rank.
  3. Return the top two bottlenecks per plant, ordered by plant, rank, week, and shift.

Schema

production_output
ColumnTypeDescription
output_idPKINTProduction output record identifier
plant_nameVARCHAR(100)Manufacturing plant name
shift_nameVARCHAR(30)Production shift
production_dateDATEDate of production
units_producedINTUnits produced during the record
planned_unitsINTPlanned units for the production record
downtime
ColumnTypeDescription
downtime_idPKINTDowntime event identifier
plant_nameVARCHAR(100)Manufacturing plant name
shift_nameVARCHAR(30)Shift during the downtime event
downtime_dateDATEDate of downtime event
downtime_minutesINTDowntime duration in minutes
reasonVARCHAR(100)Downtime reason
Tablesproduction_outputdowntime
Interviewer

Your question is SQL for Production Bottleneck Analysis. Start with the requirements and the two 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.