Introduction
Window functions and GROUP BY help summarize data, but window functions keep all rows while GROUP BY groups rows into one result each.
When you want to calculate totals but still see each individual row.
When you need to rank or number rows without losing detail.
When you want to compare each row to a group summary.
When you want to find running totals or moving averages.
When you want to group data and get one result per group.