SQL Window Functions (OVER / PARTITION BY)

Mrs. Tini’s ledger: running balances, ranks and each row’s window frame from a real SQLite, with GROUP BY beside it. 12 rows in: how many come out of each? An…

Why it matters

Window functions answer "rank within each group", "running balance" and "compared with the row before" without a slow self-join. What trips people up: the default frame taking peers along, RANK with no ORDER BY, and a window alias that WHERE cannot use.

The key idea

Every row has its own window, and the rows stay whole

Common mistakes

Try it in this playground