Module 02 · Lesson 3 of 12Pro
Window functions: running totals and rankings
- Level
- Intermediate
- Reading time
- 17 min
When you finish this page you can
- Add running totals, changes from the day before and rankings to every row with window functions, instead of folding the rows with GROUP BY.
- Choose between ROW_NUMBER, RANK and DENSE_RANK by what a tie should mean for the people who read the result.
- Predict which rows a window frame adds up, and write ROWS or RANGE on purpose so ties can’t change a number.
- Keep running totals right in a nightly pipeline when past days still change.