Skill 3.2.6

Define data aggregation, rolling average, grouping, and pivoting

Key Concepts

Aggregation summarises rows (SUM, COUNT, AVG, MIN, MAX); grouping applies aggregates per group (GROUP BY, ROLLUP, CUBE, GROUPING SETS).

Rolling average averages over a moving window using window functions: AVG(sales) OVER (ORDER BY day ROWS BETWEEN 6 PRECEDING AND CURRENT ROW). Pivoting turns row values into columns (PIVOT in Redshift, conditional aggregation in Athena); unpivoting does the reverse.