FreeSQL Foundations — your first real data skill. Start querying for free today. Start SQL →
CoursesData & AnalyticsSQL Window Functions
Data & AnalyticsIntermediate

SQL Window Functions

Unlock advanced analytics with OVER(), PARTITION BY, ROW_NUMBER, RANK, LAG, LEAD, and running totals.

~10h total
6 lessons
~4h content
Pro Access
✦ Includes mini project
⭐ Certificate of completion

No setup required · 100% browser-based

What You'll Learn

Write window functions with OVER() and PARTITION BY
Rank rows with ROW_NUMBER, RANK, DENSE_RANK
Calculate running totals and moving averages
Compare rows across time with LAG and LEAD

Course Syllabus

6 lessons · ~220 minutes
01
Intro to Window Functions
25 min
Concept
02
OVER() and PARTITION BY
35 min
Code-Along
03
ROW_NUMBER, RANK, DENSE_RANK
35 min
Code-Along
04
Running Totals & Moving Averages
35 min
Code-Along
05
LAG & LEAD for Time Comparisons
35 min
Code-Along
06
Project: Sales Trend Analysis
55 min
Project

Prerequisites

  • SQL Foundations: Subqueries & CTEs

Tools Used

PostgreSQLBrowser SQL Editor
Continue Your Journey

This course is part of the SQL for Data Analysis Track

Use SQL to build reports, answer business questions, and generate decision-ready insights.

Ready to start SQL Window Functions?