Frame

0001-01-01

Running Totals and Moving Averages

SUM OVER with ORDER BY gives you a running total. Add a ROWS BETWEEN frame and you get a sliding window — a moving average that looks back exactly N rows.

0001-01-01

Frame Semantics: ROWS, RANGE, and GROUPS

A window frame defines exactly which rows each window function sees. ROWS counts positions, RANGE counts values, GROUPS counts distinct peers. Mixing them up produces silent bugs.