Lesson 1.2

Aggregates and GROUP BY

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

Duration
6m
Level
Intermediate
Students
11k students

Overview

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

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

PostgreSQL documentation

The official reference for the tools used in this lesson.