...

/

Group Things Together

Group Things Together

Group rows and apply aggregate functions to groups.

You already know how to calculate totals, averages, and counts. But what if you want those numbers for each group, like each city or pet type? Instead of just “How many pets?” You want: “How many pets of each type?” That’s where GROUP BY shines.

Goal

You’ll aim to:

  • Group rows by a shared value (like city or type).

  • Use aggregate functions within groups. ...