SQL and PostgreSQL

Lesson 04 · 11 min

GROUP BY and aggregates

COUNT, SUM, AVG: reports without a loop in your code.

11 minLesson 4 of 10Practice includedAsk AI on any point

Aggregate functions compute over many rows: COUNT(*), SUM(total), AVG(total), MAX(created_at). GROUP BY splits rows into groups and computes the aggregate for each. HAVING filters finished groups, the way WHERE filters rows.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.