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

SQL for Operational Bottleneck Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by region and month, joining orders, shipments, and returns tables to identify bottlenecks.

Use the available records for all orders, including orders without shipments or returns. Define a bottleneck using shipment coverage, average delivery time, and return rate.

Output

  1. One row per region and order month.
  2. Columns: region, month, orders_count, shipped_orders, returned_orders, shipment_rate_pct, return_rate_pct, avg_delivery_days, bottleneck_score, bottleneck_reason, and prior_month_score.
  3. Include all order months, sort by region and month, and use NULL when a region has no prior month.

Schema

orders
ColumnTypeDescription
order_idPKINTUnique order identifier
regionVARCHAR(20)Operational region for the order
order_dateDATEDate the order was placed
shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
order_idINTOrder associated with the shipment
shipped_atTIMESTAMPTimestamp when the shipment left the facility
delivered_atTIMESTAMPTimestamp when the shipment was delivered
returns
ColumnTypeDescription
return_idPKINTUnique return identifier
order_idINTOrder associated with the return
returned_atDATEDate the return was recorded
return_reasonVARCHAR(40)Reason provided for the return
Tablesordersshipmentsreturns
Interviewer

Your question is SQL for Operational 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.