How can we explicitly specify a window frame from the start of the department partition?
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW explicitly defines an unbounded cumulative window frame.
Strict cumulative aggregation, deterministic financial totals in streaming pipelines.
SELECT
department_id,
name,
salary,
SUM(salary) OVER (
PARTITION BY department_id
ORDER BY salary
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS cumulative_salary
FROM employees;Practice typing production-grade SQL code for Cumulative Department Salary.