Guided Notes
Aggregate Functions & GROUP BY
COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING, and aliasing.
Aggregate functions
Slide 1 / 5Aggregate functions take many rows and return one value:
COUNT() — how many rows SUM() — total AVG() — average MIN() / MAX() — smallest / largest
SELECT COUNT(id) FROM comments;
returns a single number: how many comments there are. On its own, an aggregate summarizes the whole table — GROUP BY lets it summarize per group.