Lesson 1.26mIntermediate11.3k students

Aggregates and GROUP BY

Aggregation collapses rows into summaries. WHERE filters before grouping and HAVING after — mixing them up is the classic bug.

This lesson sits in SQL Essentials, part of PostgreSQL for Developers. It assumes what came before it and leads directly into the next lesson in the module.

In this lesson you will

  • Aggregate with count, sum, avg, min, and max
  • Group correctly and know what must be in GROUP BY
  • Filter groups with HAVING, rows with WHERE

Resources