Part 1 of 5 · 1 min read
Why this page comes first
In this module you will
- Explain how a window function differs from a GROUP BY aggregate.
- Use PARTITION BY to compute a value per group while keeping every row.
- Use RANK and ROW_NUMBER, and explain how they differ when values tie.
- Compute a running total using a window function.
GROUP BY collapses many rows into one per group. Many real reports need the opposite. Every row must stay, while still showing a value computed across a group of related rows, such as "this order's rank among this customer's orders." Window functions are the SQL feature built exactly for that.