How do we calculate cumulative sums or running totals across time?
SUM() OVER (ORDER BY ...) creates an expanding cumulative aggregation window across ordered rows.
Cumulative revenue, balance tracking, burn-down charts, rolling metrics in financial dashboards.
SELECT order_date,
amount,
SUM(amount) OVER (
ORDER BY order_date
) AS running_total
FROM orders;Practice typing production-grade SQL code for SQL Running Totals.