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.

6mIntermediate11,276 students
Video thumbnail for Aggregates and GROUP BY

Sign in to watch this lesson

Browsing is free. Create an account to play videos and track your progress.

Overview

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

What this lesson covers

  • 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

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
Aggregates and GROUP BY — Skiply