Loading section...
SUM/COUNT/AVG OVER
Concepts: sqlAggregateOver
Regular SUM vs SUM OVER Running Totals: SUM OVER Here is how each row's running total is calculated: Row 1 (Jan 1): just 500, nothing before it. Row 2 (Jan 2): 500 + 300 = 800. Row 3 (Jan 3): 500 + 300 + 700 = 1,500. Row 4 (Jan 4): 500 + 300 + 700 + 200 = 1,700. Row 5 (Jan 5): 500 + 300 + 700 + 200 + 400 = 2,100. Each row accumulates all previous amounts plus its own. Running totals are perfect for cumulative revenue, inventory levels, progress toward a goal, or account balances. Any "how much so far" question is a running total use case. Grand Totals: SUM OVER () Running Calculations COUNT OVER: Running Counts AVG OVER: Cumulative Avg On day 1, the average is just 500 (only one value). On day 2, it is (500 + 300) / 2 = 400. On day 3, it is (500 + 300 + 700) / 3 = 500. On day 4, it drops t