← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

SQL-heavy technical screen for a Data Engineer role at DoorDash. One question, but it had enough edge cases baked in that I spent most of the time second-guessing my own logic rather than writing the query.

Questions Asked (1)

Q1

Given a schema with merchants, menus, orders, and dashers, write a SQL query that returns the percentage of active merchants whose entire menu consists only of vegetarian items. A merchant counts as fully vegetarian only if it has at least one menu item and every item has is_vegetarian = 1.

Data ModelingProduct Analytics & Metrics
Author's notes

I got the core logic pretty fast but stumbled on the edge cases.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, identify active merchants and compute their total menu item count and vegetarian item count. Then filter for merchants where total count > 0 and total count equals vegetarian count, and finally divide the count of such merchants by the total number of active merchants, multiplying by 100 to get a percentage.

Pro tip: Clarify the definition of 'active merchant' upfront—whether it's based on a status column, recent orders, or another criterion—and confirm that merchants with no menu items are excluded from the numerator but included in the denominator.

1. Identify active merchants

Filter the merchants table to only those with an active status (e.g., is_active = 1 or status = 'active'). This forms the base population for the denominator.

2. Aggregate menu items per merchant

Join the filtered merchants with the menus and menu_items tables, then group by merchant to compute total item count and vegetarian item count (SUM of is_vegetarian).

3. Identify fully vegetarian merchants

Filter the grouped results to merchants where total item count > 0 and total item count equals vegetarian item count. These merchants have at least one item and all items are vegetarian.

4. Compute the percentage

Count the number of fully vegetarian merchants and divide by the total number of active merchants, then multiply by 100. Use a subquery or CTE to avoid division by zero and ensure correct aggregation.

Key Points to Mention

  • Definition of 'active merchant' and how it affects the denominator
  • Handling merchants with no menu items (excluded from numerator but included in denominator)
  • Using LEFT JOIN to include merchants without menu items in the denominator
  • Ensuring at least one menu item exists for a merchant to be considered fully vegetarian
  • Using conditional aggregation (SUM(CASE WHEN is_vegetarian = 1 THEN 1 ELSE 0 END)) to count vegetarian items
  • Avoiding integer division by casting to float or multiplying by 100.0

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