🪟
Advanced About 30 min

Window Functions

OVER(), PARTITION BY, ROW_NUMBER, RANK, LAG/LEAD — calculations across related rows without collapsing them.

What you'll learn

  • Use OVER() to compute across rows without collapsing them
  • Partition results into groups with PARTITION BY
  • Rank and number rows with ROW_NUMBER, RANK, and DENSE_RANK
  • Access previous and next rows with LAG and LEAD
  • Calculate running totals and moving averages with SUM/AVG OVER