← DoorDash Interview Insights

DoorDash·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

DoorDash data science interview with a SQL-heavy operations question focused on delivery performance. The problem was grounded in a realistic schema and pushed into ranking territory at the end, which I wasn't fully expecting.

Questions Asked (1)

Q1

Using an orders table with timestamps for estimated and actual delivery, write a SQL query that shows, for each day in the last 7 days, the total number of orders and the percentage delivered more than 10 minutes late. Then extend it to rank the top 5 restaurants by average delivery delay over that same window.

Product Analytics & MetricsData Modeling
Author's notes

The daily aggregation part was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and definitions (e.g., delivery delay = actual_delivery - estimated_delivery, late threshold > 10 minutes). Then write a query that groups orders by delivery date (filtered to last 7 days), calculates total orders and the percentage late, and finally extends it with a second query that ranks restaurants by average delay over the same period.

Pro tip: Mention that you would handle edge cases like null timestamps or timezone differences, and that you'd validate the query with a quick sanity check (e.g., total orders per day should match known volumes).

1. Clarify requirements and schema

Confirm the table structure, column names, and definitions: what constitutes a delivery delay, how to handle nulls, and whether 'last 7 days' includes today. Also clarify if the percentage should be based on all orders or only delivered ones.

2. Write daily aggregation query

Use a CTE or subquery to filter orders from the last 7 days, compute delay in minutes, and flag orders with delay > 10. Then group by delivery date to get total orders and percentage late.

3. Extend to restaurant ranking

Write a second query that groups by restaurant, calculates average delay over the same 7-day window, orders by average delay descending, and limits to top 5.

4. Optimize and validate

Consider indexing on delivery timestamp and restaurant ID for performance. Validate results by checking for anomalies (e.g., days with zero orders) and ensuring the percentage is between 0 and 100.

Key Points to Mention

  • Definition of delivery delay: actual_delivery - estimated_delivery, and threshold > 10 minutes.
  • Handling of time zones and date truncation (e.g., using DATE() or CAST to date).
  • Use of conditional aggregation (CASE WHEN) to compute percentage late.
  • Filtering for last 7 days using CURRENT_DATE - INTERVAL '7 days' or similar.
  • Ranking with ORDER BY and LIMIT, and considering ties or using window functions if needed.
  • Performance considerations: indexing, avoiding full table scans, and using appropriate date functions.

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