PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/DoorDash

Find orders from bottom-quartile revenue restaurants

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in SQL data manipulation, including time-windowed aggregation, joins, filtering by status and date, and percentile-based ranking of restaurant revenue using completed orders.

  • Medium
  • DoorDash
  • Data Manipulation (SQL/Python)
  • Data Scientist

Find orders from bottom-quartile revenue restaurants

Company: DoorDash

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

## SQL Question You want to identify **orders coming from restaurants whose total revenue is in the bottom 25th percentile**. Assume the following tables: ### `restaurants` - `restaurant_id` (BIGINT, PK) - `name` (VARCHAR) - `market_id` (BIGINT) ### `orders` - `order_id` (BIGINT, PK) - `restaurant_id` (BIGINT, FK → restaurants.restaurant_id) - `customer_id` (BIGINT) - `order_total` (DECIMAL(10,2)) — revenue for this order (exclude tips) - `created_at` (TIMESTAMP) - `status` (VARCHAR) — e.g., 'completed', 'canceled' ## Task Write a SQL query to return orders from restaurants whose **total completed-order revenue** is in the **bottom 25%** among all restaurants over a specified analysis window. ### Requirements - Use an analysis window of the **last 30 days** relative to `CURRENT_DATE`. - Consider only `status = 'completed'` orders. - Define restaurant revenue as `SUM(order_total)` over the window. - Compute the **25th percentile** of restaurant revenue across restaurants with ≥1 completed order in the window. ### Output columns - `order_id` - `restaurant_id` - `order_total` - `created_at` - `restaurant_revenue_30d` State any assumptions (e.g., percentile function availability in your SQL dialect).

Quick Answer: This question evaluates proficiency in SQL data manipulation, including time-windowed aggregation, joins, filtering by status and date, and percentile-based ranking of restaurant revenue using completed orders.

Related Interview Questions

  • Calculate Order Request Metrics - DoorDash (hard)
  • Analyze Restaurant Customer Metrics - DoorDash (medium)
  • Write SQL for monthly spend and ratios - DoorDash (medium)
  • Write SQL for late-delivery metrics by window - DoorDash (Medium)
  • Compute rolling cold-delivery rates with windows - DoorDash (Medium)
DoorDash logo
DoorDash
Jul 7, 2025, 12:00 AM
Data Scientist
Onsite
Data Manipulation (SQL/Python)
3
0

SQL Question

You want to identify orders coming from restaurants whose total revenue is in the bottom 25th percentile.

Assume the following tables:

restaurants

  • restaurant_id (BIGINT, PK)
  • name (VARCHAR)
  • market_id (BIGINT)

orders

  • order_id (BIGINT, PK)
  • restaurant_id (BIGINT, FK → restaurants.restaurant_id)
  • customer_id (BIGINT)
  • order_total (DECIMAL(10,2)) — revenue for this order (exclude tips)
  • created_at (TIMESTAMP)
  • status (VARCHAR) — e.g., 'completed', 'canceled'

Task

Write a SQL query to return orders from restaurants whose total completed-order revenue is in the bottom 25% among all restaurants over a specified analysis window.

Requirements

  • Use an analysis window of the last 30 days relative to CURRENT_DATE .
  • Consider only status = 'completed' orders.
  • Define restaurant revenue as SUM(order_total) over the window.
  • Compute the 25th percentile of restaurant revenue across restaurants with ≥1 completed order in the window.

Output columns

  • order_id
  • restaurant_id
  • order_total
  • created_at
  • restaurant_revenue_30d

State any assumptions (e.g., percentile function availability in your SQL dialect).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More DoorDash•More Data Scientist•DoorDash Data Scientist•DoorDash Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.