How can we compute cumulative revenue over time?
SUM() OVER (ORDER BY date) accumulates values incrementally from the start of the partition.
Cumulative sales charts, year-to-date spend curves, burn rate tracking.
SELECT
order_date,
amount,
SUM(amount) OVER (
ORDER BY order_date
) AS running_total
FROM orders;Practice typing production-grade SQL code for Running Total.