Cumulative Campaign Budget
Problem
**[Commonly asked at Airbnb, Lyft]**
A marketing team runs campaigns with daily spend. The CFO wants a **running total**
of all spend to date, so the finance team can see the budget burn over time.
Given a daily spend table, return each date, its daily spend, and the **cumulative
spend** up to and including that date. Order by date ascending.
Tables
Example rows — the live problem includes the full dataset.
campaign_spend
| spend_id | spend_date | daily_spend |
|---|
Expected output
Your answer should return 6 rows with the columns spend_date, daily_spend, cumulative_spend.
Starter code (SQL)
SELECT *
FROM campaign_spend;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock