Skip to main content
PProfileMatch
← Path

Advanced SQL · SQL Window Functions: ROW_NUMBER, RANK, Running Totals, LAG and LEAD

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Velodrome entrance: the lap board

Trick to keep in mind+3 XP

OVER keeps the rows; GROUP BY folds them.

A window function computes a value from a set of related rows and attaches it to each row, so your result has as many rows as the table. GROUP BY instead collapses each group into one summary row. If your output shrank, you grouped; if every original row is still there with an extra column, you windowed.

Read it once, then a question tests whether the trick stuck.