Introduction to Window Functions
Window functions calculate across related rows WITHOUT collapsing them like GROUP BY.
Add row numbers:
Key difference from GROUP BY:
GROUP BYcollapses rows into groups- Window functions keep ALL rows, adding computed columns
The OVER() clause defines the "window" of rows.
Check your understanding
Add a row number to each employee, ordered by salary (highest first).
Examples run on the employees sample database. Open any of them in the playground to experiment.