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
Analyzing Operations Bottlenecks with SQL
00:00
5 left

Analyzing Operations Bottlenecks with SQL

HardSQL · PostgreSQL

Problem

Business Context

Samsung Electronics operations leaders need a daily view of regional fulfillment performance across orders, inventory, and shipments. The analysis should distinguish delivery delays from inventory constraints and missing operational data.

Task

Write a PostgreSQL query that analyzes orders placed in January 2025 by region and order date.

Requirements

  1. Use the most recent inventory snapshot on or before each order date, without duplicating orders.
  2. Use a LEFT JOIN for shipments so unshipped orders remain visible, and classify orders as late when delivery exceeded the promised date or was still missing on February 1, 2025.
  3. Report order count, late orders, late-delivery percentage, inventory-shortage orders, orders with unavailable inventory data, and average delivery days.
  4. Use LAG to show the previous available day's late-delivery percentage for the same region.
  5. Return one row per region and order date, ordered by region and date.

Schema

orders
ColumnTypeDescription
order_idPKINTUnique order identifier
regionVARCHAR(40)Samsung sales or fulfillment region
product_idVARCHAR(20)Product identifier
warehouse_idVARCHAR(20)Fulfillment warehouse identifier
order_dateDATEDate the order was placed
promised_dateDATEPromised delivery date
quantityINTUnits ordered
inventory_snapshots
ColumnTypeDescription
inventory_snapshot_idPKINTUnique inventory snapshot identifier
product_idVARCHAR(20)Product identifier
warehouse_idVARCHAR(20)Warehouse identifier
snapshot_dateDATEDate inventory was recorded
available_qtyINTUnits available at the snapshot
shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
order_idINTRelated order identifier
shipped_dateDATEDate shipment left the warehouse
delivered_dateDATEDate shipment was delivered
carrierVARCHAR(40)Shipping carrier
Tablesordersinventory_snapshotsshipments
Interviewer

Your question is Analyzing Operations Bottlenecks with SQL. 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.