Aggregates without collapsing
GROUP BY collapses rows into summaries. Window functions compute across rows without collapsing — every row keeps its identity and gains a calculated value. Think of it as writing notes in the margin of each row.
The OVER clause
SUM(total) OVER (PARTITION BY user_id ORDER BY placed_at): for each row, sum the total of every row in the same user partition up to the current row (running total). Without ORDER BY, you'd get the per-partition total on every row. PARTITION BY is like GROUP BY but doesn't collapse.
Frame clauses
For sliding windows like moving averages, add a frame: ROWS BETWEEN 6 PRECEDING AND CURRENT ROW. This computes over the current row plus the previous six — a 7-row moving average.