Analyze Monthly Customer and Restaurant Spend Data
Company: DoorDash
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Technical Screen
orders
+-----------+-------------+---------------+------------+--------+
| order_id | customer_id | restaurant_id | order_date | amount |
+-----------+-------------+---------------+------------+--------+
| 1001 | 501 | 3001 | 2023-05-12 | 45.20 |
| 1002 | 502 | 3002 | 2023-05-12 | 120.00 |
| 1003 | 501 | 3003 | 2023-06-04 | 99.99 |
| 1004 | 503 | 3001 | 2023-06-15 | 210.50 |
| 1005 | 504 | 3002 | 2023-07-02 | 15.25 |
+-----------+-------------+---------------+------------+--------+
##### Scenario
You are a data scientist at a food-delivery marketplace. You have an orders table that logs every completed order. Business wants monthly insights on spend, restaurant performance, and customer mix.
##### Question
Write a SQL query to return all customers who spent more than $100 in every calendar month they transacted. 2. Among customers NOT returned in
(
1), find those with the highest total monthly spend for each month. 3. For a given restaurant_id, show its month-over-month gross revenue and the percentage change versus the prior month. 4. In any month, what proportion of orders come from restaurants whose monthly revenues fall in the bottom 25 th percentile of all restaurants for that month?
##### Hints
Think window functions, GROUP BY month, conditional aggregation, percentile/NTILE for bottom-quartile filter.
Quick Answer: This question evaluates proficiency in SQL data manipulation, including aggregation, date-based grouping, window functions, and percentile-based analysis to quantify monthly customer spend and restaurant revenues.