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 Warehouse Performance
00:00
5 left

SQL for Warehouse Performance

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze warehouse performance at Sysco by joining shipment, inventory, and labor tables to calculate cases per hour and dock-to-stock time by facility. Use the supplied tables and include facilities appearing in any source table. Handle missing values and zero labor hours without causing errors.

Output

  1. One row per facility, including facilities without matching records in another table.
  2. Columns: facility_id, shipped_cases, labor_hours, cases_per_hour, and avg_dock_to_stock_minutes.
  3. Round calculated metrics to two decimal places, sort by facility_id ascending, and return NULL when a metric cannot be calculated.

Schema

shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
facility_idVARCHAR(10)Sysco warehouse facility identifier
shipped_atTIMESTAMPShipment completion timestamp
cases_shippedINTNumber of cases shipped
inventory_events
ColumnTypeDescription
event_idPKINTUnique inventory event identifier
facility_idVARCHAR(10)Sysco warehouse facility identifier
received_atTIMESTAMPTimestamp when inventory arrived at the dock
stocked_atTIMESTAMPTimestamp when inventory was placed into stock
cases_receivedINTNumber of cases received
labor_shifts
ColumnTypeDescription
shift_idPKINTUnique labor shift identifier
facility_idVARCHAR(10)Sysco warehouse facility identifier
shift_dateDATEDate of the labor shift
hours_workedDECIMAL(6,2)Labor hours recorded for the shift
Tablesshipmentsinventory_eventslabor_shifts
Interviewer

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