Analyze User and Merchant Behavior with Order Data
Company: DoorDash
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Technical Screen
orders
+----------+---------+-------------+------------+-------------+
| order_id | user_id | merchant_id | order_date | order_value |
+----------+---------+-------------+------------+-------------+
| 1 | 101 | 9001 | 2023-01-05 | 23.50 |
| 2 | 102 | 9002 | 2023-01-05 | 45.20 |
| 3 | 101 | 9003 | 2023-01-10 | 12.00 |
| 4 | 103 | 9001 | 2023-02-02 | 30.00 |
| 5 | 104 | 9002 | 2023-02-09 | 60.75 |
+----------+---------+-------------+------------+-------------+
##### Scenario
Food-delivery platform wants to understand user and merchant behavior using order data.
##### Question
Calculate the percentage of users who are high-frequency customers (e.g., > N orders within a month). 2. After excluding high-frequency users, compute the total order value for each calendar month. 3. Identify the customer with the single highest order value and return user_id and amount. 4a. List merchants that fall into the bottom revenue quantile (e.g., bottom 25%). 4b. Given an existing query that finds bottom-quantile merchants, modify it per a new prompt supplied during the interview.
##### Hints
Use window functions, CTEs, aggregation, and percentile logic; state assumptions clearly.
Quick Answer: This question evaluates proficiency in data manipulation and analytical querying using SQL and Python, including aggregation, window functions, percentile-based segmentation, and cohort filtering to derive user- and merchant-level metrics.