How do window functions differ from GROUP BY, and ROW_NUMBER from RANK and DENSE_RANK?
Short answer
GROUP BY collapses many rows into one per group. A window function computes over a set of related rows but keeps every row, so you can show details next to totals, ranks and running sums.
3 points to say:
GROUP BYcollapses rows, windows keep them.RANK1,1,3;DENSE_RANK1,1,2.- Running totals: write
ROWSexplicitly.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.