

Lesson 10 · 11 min
Window functions
An aggregate that doesn't collapse rows: rank, running total.
11 minLesson 10 of 10Practice includedAsk AI on any point
GROUP BY turns a group into one row. A window function computes over the group but keeps every row in place. OVER (…) defines the window: PARTITION BY splits rows into groups, ORDER BY sets the order inside. ROW_NUMBER() numbers rows, RANK() gives a rank that accounts for ties, SUM(…) OVER gives a running total, LAG() gives the value from the previous row.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.