PracHub
QuestionsLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/DoorDash

Calculate Monthly Restaurant Sales Growth

Last updated: Aug 7, 2026

Quick Overview

A PostgreSQL interview problem about calculating month-over-month restaurant sales growth. It tests monthly aggregation, window functions, missing prior periods, division-by-zero handling, and deterministic result ordering.

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

Calculate Monthly Restaurant Sales Growth

Company: DoorDash

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Technical Screen

# Calculate Monthly Restaurant Sales Growth Write one PostgreSQL SELECT statement or CTE query. Do not create, alter, or modify tables. ## Schema delivery_orders | column | type | |---|---| | delivery_id | integer | | order_place_time | timestamp | | restaurant_id | integer | order_value | column | type | |---|---| | delivery_id | integer | | order_total | numeric | ## Task For restaurant 8, calculate month-over-month percentage sales change for February through December 2021. Assume the restaurant has at least one delivery in every month of 2021. ## Required Output Return sales_month, monthly_sales, previous_month_sales, and growth_pct rounded to two decimal places. Sort by month ascending. ## Constraints - Aggregate monthly sales before using a window function. - Ignore January in the final output but retain it to calculate February growth. - If previous-month sales are zero, return NULL growth rather than dividing by zero. ```hint Lag the monthly total Join orders to values, aggregate by month, and use LAG on those twelve monthly rows. ```

Quick Answer: A PostgreSQL interview problem about calculating month-over-month restaurant sales growth. It tests monthly aggregation, window functions, missing prior periods, division-by-zero handling, and deterministic result ordering.

Related Interview Questions

  • Measure Customers Ordering from Bottom-Quartile Restaurants - DoorDash (easy)
  • Find Monthly Top Customers Excluding High-Frequency Users - DoorDash (easy)
  • Calculate the Monthly Share of High-Frequency Customers - DoorDash (easy)
  • Measure Daily Late-Order Rates by Delivery Zone - DoorDash (medium)
|Home/Data Manipulation (SQL/Python)/DoorDash

Calculate Monthly Restaurant Sales Growth

DoorDash logo
DoorDash
Jul 27, 2026, 12:00 AM
easyData ScientistTechnical ScreenData Manipulation (SQL/Python)
0
0

Calculate Monthly Restaurant Sales Growth

Write one PostgreSQL SELECT statement or CTE query. Do not create, alter, or modify tables.

Schema

delivery_orders

columntype
delivery_idinteger
order_place_timetimestamp
restaurant_idinteger

order_value

columntype
delivery_idinteger
order_totalnumeric

Task

For restaurant 8, calculate month-over-month percentage sales change for February through December 2021. Assume the restaurant has at least one delivery in every month of 2021.

Required Output

Return sales_month, monthly_sales, previous_month_sales, and growth_pct rounded to two decimal places. Sort by month ascending.

Constraints

  • Aggregate monthly sales before using a window function.
  • Ignore January in the final output but retain it to calculate February growth.
  • If previous-month sales are zero, return NULL growth rather than dividing by zero.
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)

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

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

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding 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.