← DoorDash Interview Insights

DoorDash·Data Scientist·Take-home Assignment·Senior

Senior
Sep 2025Remote

Summary

DoorDash DS take-home centered entirely on a multi-table SQL schema for new-market readiness. Three fairly involved queries covering daily launch health, supply-demand risk flagging, and courier activation funnels. The kind of prompt that looks clean on paper but has a lot of edge cases hiding in it.

Questions Asked (3)

Q1

Given a schema with cities, merchants, couriers, and orders tables, write SQL to compute per-day launch health metrics for a specific city over a 7-day window. Include orders created, delivered, and cancelled counts, median delivery ETA in minutes, and merchant coverage per 10k population. Flag each day as at-risk if median ETA exceeds 35 minutes or cancel rate exceeds 8%.

Product Analytics & MetricsData Modeling
Author's notes

The median ETA part is what slowed me down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and metric definitions, then structure the SQL using CTEs to compute daily aggregates and window functions for medians. Finally, join with population data to calculate merchant coverage and apply the at-risk flag based on thresholds.

Pro tip: Use PERCENTILE_CONT for median ETA and ensure you handle edge cases like days with zero orders by using LEFT JOINs from a date spine. Also, consider timezone consistency for 'per-day' metrics.

1. Clarify Requirements and Schema

Confirm table structures, column names, and metric definitions (e.g., delivery ETA, cancel rate). Ask about timezone and whether 'per-day' is based on order creation date.

2. Generate Date Spine and Filter City

Create a date series for the 7-day window and filter to the specific city. This ensures all days are represented, even with no orders.

3. Compute Daily Aggregates

Use CTEs to calculate orders created, delivered, cancelled, and median delivery ETA per day. Join orders with merchants and couriers as needed.

4. Calculate Merchant Coverage

Count distinct merchants per day and divide by (city population / 10000) to get coverage per 10k population. Join with population data.

5. Apply At-Risk Flag and Finalize

Flag days where median ETA > 35 minutes or cancel rate > 8%. Use CASE statements and ensure all metrics are correctly aggregated.

Key Points to Mention

  • Use of CTEs for readability and modularity
  • Median calculation with PERCENTILE_CONT or APPROX_PERCENTILE
  • Handling days with no orders via LEFT JOIN from date spine
  • Cancel rate calculation: cancelled / created
  • Merchant coverage: distinct merchants per 10k population
  • At-risk flag logic with OR condition

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Using a supply_demand table with 15-minute interval granularity, write SQL to aggregate by day the share of intervals where active couriers divided by demand requests falls below 0.8. Flag days where more than 25% of intervals are in that undersupply state.

Product Analytics & MetricsRoot Cause Analysis
Author's notes

NULLIF was explicitly hinted in the prompt so that part wasn't a gotcha, but the day-level aggregation from 15-min buckets is easy to mess up if you're not careful about how you truncate the timestamp.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the table schema and metric definitions, then write a SQL query that computes the ratio of active couriers to demand requests per 15-minute interval, flags intervals below 0.8, aggregates by day to get the share of undersupplied intervals, and finally flags days where that share exceeds 25%. Explain each step and consider edge cases like missing data or zero demand.

Pro tip: Mention that you would validate the query by checking a few days manually and consider using a CTE for readability; also note that the 0.8 threshold and 25% cutoff are business rules that might need adjustment based on context.

1. Clarify schema and definitions

Confirm the table columns (e.g., timestamp, active_couriers, demand_requests) and define what 'active couriers' and 'demand requests' mean. Ensure the 15-minute interval granularity and how to handle missing or zero demand.

2. Compute interval-level undersupply flag

Write a subquery or CTE that calculates the ratio of active couriers to demand requests for each 15-minute interval and flags intervals where the ratio is below 0.8. Handle division by zero (e.g., using NULLIF).

3. Aggregate by day

Group the flagged intervals by day (using DATE(timestamp)) and compute the total number of intervals and the number of undersupplied intervals. Calculate the share as undersupplied intervals divided by total intervals.

4. Flag days exceeding threshold

In the final SELECT, add a boolean flag (e.g., is_undersupply_day) that is TRUE when the share of undersupplied intervals is greater than 0.25. Optionally, filter to only show flagged days.

5. Validate and optimize

Check results for a few days manually, ensure the query handles edge cases (e.g., days with no intervals), and consider indexing or partitioning for performance if the table is large.

Key Points to Mention

  • Use of CTEs or subqueries for readability and stepwise logic
  • Handling division by zero with NULLIF or CASE statements
  • Correct aggregation: counting intervals per day and computing the share
  • Applying the 0.8 threshold at the interval level before aggregation
  • Flagging days where the share exceeds 25% using a CASE or boolean expression
  • Considering data quality issues like missing intervals or zero demand

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

For couriers who signed up in a given city within a specified date range, compute cohort-level activation and delivery funnel metrics: what share activated within 14 days of signup, what share completed a first delivery, and what was the median time from signup to first delivery in minutes. Return a single summary row.

Product Analytics & MetricsData ModelingGo-to-Market (GTM)
Author's notes

This one tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the cohort as couriers who signed up in the specified city and date range, then compute activation (e.g., first login or first dash) within 14 days, first delivery completion, and median time to first delivery. Use a single SQL query with CTEs to filter, aggregate, and return one summary row, ensuring proper handling of time zones and denominators.

Pro tip: Always clarify the definition of 'activation' and 'first delivery' with the interviewer, as these can vary by company; also, use median (not average) for time-to-delivery to avoid skew from outliers.

1. Define cohort and metrics

Identify the exact signup date range and city filter, and confirm what constitutes 'activation' (e.g., first login, first dash) and 'first delivery' (e.g., first completed delivery).

2. Filter and join tables

Use a CTE to select couriers who signed up in the given city and date range, then left join to activation and delivery events to get timestamps.

3. Compute activation and delivery shares

Calculate the percentage of couriers who activated within 14 days of signup and the percentage who completed at least one delivery, using conditional aggregation.

4. Calculate median time to first delivery

For couriers with a first delivery, compute the time difference in minutes between signup and first delivery, then take the median across the cohort.

5. Return single summary row

Combine all metrics into one row using a final SELECT that outputs activation_rate, delivery_rate, and median_time_to_first_delivery_minutes.

Key Points to Mention

  • Cohort definition: signup date range and city filter
  • Activation definition: e.g., first login or first dash within 14 days
  • First delivery definition: first completed delivery
  • Use of median instead of average for time-to-delivery
  • Handling of time zones and timestamp precision
  • Denominator: all couriers in cohort, not just those who activated or delivered

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.