The analytics team wants to see how revenue has been stacking up day by day — not just each day in isolation, but the cumulative picture. Using the sales table, compute a running total of amount ordered by sale_date. Return sale_date, amount, and running_total.
sales
| column | type |
|---|---|
| id | INTEGER |
| sale_date | DATE |
| amount | NUMERIC |
| id | sale_date | amount |
|---|---|---|
| 1 | 2024-01-01 | 100 |
| 2 | 2024-01-02 | 250 |
| 3 | 2024-01-03 | 75 |
| 4 | 2024-01-04 | 300 |
| 5 | 2024-01-05 | 150 |
| sale_date | amount | running_total |
|---|---|---|
| 2024-01-01 | 100 | 100 |
| 2024-01-02 | 250 | 350 |
| 2024-01-03 | 75 | 425 |
| 2024-01-04 | 300 | 725 |
| 2024-01-05 | 150 | 875 |
Each row's running_total is the sum of all amount values up to and including that date. By Jan 5, the cumulative total reaches 100 + 250 + 75 + 300 + 150 = 875.