Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return order_day, daily_revenue, and running_revenue.
Result columns · in this order
order_daydaily_revenuerunning_revenueHow to approach it
Create daily revenue first, then run the cumulative SUM.
Sample input
| order_day | daily_revenue |
|---|---|
| 2026-01-12 | 200 |
| 2026-01-13 | 40 |
| 2026-01-15 | 220 |
| 2026-01-18 | 540 |
| 2026-01-20 | 60 |
5 rows — all rows shown.
Expected output
| order_day | daily_revenue | running_revenue |
|---|---|---|
| 2026-01-12 | 200 | 200 |
| 2026-01-13 | 40 | 240 |
| 2026-01-15 | 220 | 460 |
| 2026-01-18 | 540 | 1000 |
| 2026-01-20 | 60 | 1060 |
5 rows — all rows shown.
Constraints
Aggregate daily revenue first, then use SUM OVER ordered by order_day.
Expected skills
Window aggregate frames and cumulative metrics.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.