Skip to main content
CodingHelp
HomeCareersCoursesSurveyCareer surveyForumsFAQContact
Log inSign up
Back to course overview
SQL for Analysis

Window Functions

Rank rows within groups, compute running totals and moving averages, and measure period-over-period change, all without losing row detail.

3 lessons · 1h 57m
  • ROW_NUMBER and RANKReading

    Rank rows within groups with ROW_NUMBER, RANK and DENSE_RANK, and use the top-N-per-group pattern.

    49m
  • Running totals and moving averagesReading

    Turn SUM and AVG into window functions to compute running totals, shares of total and moving averages with window frames.

    35m
  • LAG and LEADReading

    Compare each row with the previous or next one to compute month-over-month change and gaps between events.

    33m
Coding Help
  • About
  • Careers
  • Courses
  • Career survey
  • Forums
  • FAQ
  • Contact
  • Terms
  • Privacy