Window frames, running totals, LAG/LEAD, top-N per group, de-duplication, pivots with CASE, gaps and islands, dates and dialect differences for data analysis.
Window function vs GROUP BY: what is the key difference?
Tap to flip
Back
GROUP BY collapses rows into one row per group. A window function computes a value over a set of related rows but keeps every input row, so you can show a row's value next to its group total, rank or previous value.