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
Analyze Late Deliveries with SQL
00:00
5 left

Analyze Late Deliveries with SQL

MediumSQL · PostgreSQL

Problem

What SQL query would you use to analyze late deliveries by warehouse, day of week, and delivery window at Gopuff?

Use the provided delivery, warehouse, and delivery-window data. Treat a delivery as late when it arrives after its promised time, and exclude records without the timestamps or dimension values needed for this analysis.

Output

  1. One row per warehouse, weekday, and delivery window with qualifying deliveries
  2. Columns: warehouse_name, weekday_number, weekday_name, window_name, total_deliveries, late_deliveries, late_percentage
  3. Order by warehouse name, weekday number, then window name

Schema

deliveries
ColumnTypeDescription
delivery_idPKINTUnique delivery identifier
warehouse_idINTWarehouse fulfilling the delivery
window_idINTPromised delivery-window identifier
promised_atTIMESTAMPPromised delivery timestamp
delivered_atTIMESTAMPActual delivery timestamp
warehouses
ColumnTypeDescription
warehouse_idPKINTUnique warehouse identifier
warehouse_nameVARCHAR(100)Gopuff warehouse name
cityVARCHAR(100)Warehouse city
delivery_windows
ColumnTypeDescription
window_idPKINTUnique delivery-window identifier
window_nameVARCHAR(100)Readable delivery-window name
window_startTIMEWindow start time
window_endTIMEWindow end time
Tablesdeliverieswarehousesdelivery_windows
Interviewer

Your question is Analyze Late Deliveries 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.