Last Updated: May 3, 2026
SUM, AVG, and COUNT collapse rows into a single result when used with GROUP BY. But sometimes you need a cumulative sum that grows row by row, or a rolling average over the last few entries, while keeping every row visible.
That's what window aggregates do: they run an aggregate function across a sliding or expanding frame of rows, producing one result per row instead of one result per group.