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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Start free
Case Study With SQL Live Coding
00:00
5 left

Case Study With SQL Live Coding

MediumSQL · PostgreSQL

Problem

Case study interview followed by SQL live coding at DoorDash USA.

For the SQL portion, use the provided markets and deliveries tables to report observed market-months from Q1 2025. Return completed-delivery counts, average duration for completed deliveries, and each market's rank within its month; retain observed market-months with zero completed deliveries.

Output

  1. One row per observed market and calendar month in Q1 2025
  2. Columns: market_name, month_start, completed_deliveries, avg_duration_minutes, and market_rank
  3. Sort by month_start, market_rank, then market_name

Schema

markets
ColumnTypeDescription
market_idPKINTUnique market identifier
market_nameVARCHAR(100)Display name of the market
deliveries
ColumnTypeDescription
delivery_idPKINTUnique delivery identifier
market_idINTMarket associated with the delivery
statusVARCHAR(20)Delivery outcome
placed_atTIMESTAMPTimestamp when the delivery was placed
delivered_atTIMESTAMPTimestamp when the delivery was completed
Tablesmarketsdeliveries
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.