A window function computes a value across a set of rows related to the current row without collapsing those rows into one, which is the difference between SUM(amount) OVER (PARTITION BY user_id) and a GROUP BY. That is what makes running totals, per-customer rankings and month-over-month deltas possible in a single pass over the table. Every question below runs against a real database in the browser, so you write the OVER clause and see the result set immediately.