---
title: Understanding SQL GROUP BY
teaser: 'Finally, you too can understand how to use GROUP BY in your SQL queries.

  '
tags: sql
author: Edward Loveall
published_on: 2021-02-17
---

> This is part 3 of a series on SQL basics. Read [part 1][part-1] and [part 2][part-2] for context on `SELECT`, `WHERE`, and `JOIN` and how to set up a test database to follow along with these examples.

When I first had to use `GROUP BY`, it was anything but intuitive. It was only after I learned the mental model below that it started to make sense.

## Do You Speak SQL?

Let's say we want to know the number of languages spoken in each country in our database. This is a perfect case for grouping. The `countrylanguage` table has one row per language per country so we should be able to count them up. According to this, there are twelve languages spoken in the USA:

```sql
SELECT * FROM countrylanguage
WHERE countrycode = 'USA';
```

But how do we show that as a number?

## There Can Be Only One

A lot of people (including a past-me) think of `GROUP BY` like a parent-child sort of structure, where you group by some key (like `countrycode`) and all other attributes that related to that key are nested inside.

<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="949.3 605.1 339 204.4">
  <title>Missing data in a languages table</title>
  <desc>A table with two columns listing country codes and a language spoken in that country. The country code is USA for the first row, then blank for the remaining.</desc>
  <style>
    .lines {
      stroke: currentColor;
      stroke-width: 1.8;
    }
    .lines path {
      stroke-linecap: round;
      stroke-linejoin: round;
      fill: none;
    }
    .lines circle {
      fill: currentColor;
      stroke-width: 0.1;
    }
  </style>
  <g class="lines">
    <path d="M966 655.7h.2l-.5-.3h-1q0 0 0 0h-.9l-.8.7q-.1.1 0 0 0 0 0 0l-.6.6-.6.5h0q-.2.1-1 2-.8 2-1 3l-.1 1.5-.1 1.1v1l.2.7.2.3.2.3v.2q0 .2.4.4l.7.2.4.1h.4l.7-.3q.4-.1.2 0h.4q.6 0 1.7-.4l1.3-.6m13.4-5.1l-1-.3q-.2 0 0 0h-1l-.8.6q-.2 0-.2.2l-.5.6-.3.5q0 0 0 0h-.2q-.4.1-.3 4.3v-.1q-.2 0 .6.4t1.9.2q1.1-.3 1.7-1l1-1.4q.5-.7.6-1.5l.1-.7v-1.6l-.2-.4q0 0 0 0-.1 0 0 0l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q-.2.7-.6 7.8-.1-1 .3-3t1-3.2q.5-1.2 1.2-1.8l1.3-.8q.5-.2.6-.1.2 0 .5.4l.3.4.1.5v.6q-.1.4.3.8l.5.5m8.2-2.7v-.1q0 0 0 0-.3.3-.5 10.4l.1-2q0-2 .6-3.6.5-1.6 1-2l.6-.8.3-.2q0 0 0 0l.5-.3q.6-.3.4-.3-.1.1.2 0 .3-.2.7-.2.3.9.5 4 .2-.4 0-.2l.3-.7q.4-1 .8-1.5.4-.6.7-.7h.2l.3-.1q.4-.2 1-.2.7 0 1.4.6l1 .9.5.8.2.9v4.2h.1v-.2l.1-.3m13.6-7.9q.2.1-.2-.7h-.6l-1 .4-.4.4-.5.4-.3.2-.4.4-.2.3q0 0 0 0l-.4.5-.7 2q-.4 1.2-.4 2 0 .7.3 1 .2.4.5.6l.2.1q0 0 0 0l.9.2 1.3.3q.6 0 1-.8.5-1 1-2.6.6-1.7.5-3.7l.4 1.5q.5 2 1.2 3 .6 1.3 1 1.8l.8.8.6.5.3.1.2.2 1.3.6v-.3l-.1-.4m5.3-9.5v-.2l-.4 8q-.2.6.2-1.5.3-2 .9-3.3.6-1.3 1.3-2 .7-.9 1-1h.4q.1-.2.4-.2l.6.3q.4.2.6.6l.2.4.4.6.2.4.4.9q.4 1 .6 5.9h.1v-.5"/>
  </g>
</svg>

In the [last post](https://thoughtbot.com/blog/understanding-sql-join), I stressed that SQL actions like `WHERE` and `SELECT` act on a single table. There's a corollary for rows: every table row has **one and only one** value per column. That means the above table is not possible to represent in SQL.

If you ran the query at the start of the post, you'll know that the data that we have before we group looks more like this:

<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="578.8 614.1 300.6 194.7">
  <title>Duplicated data in a languages table</title>
  <desc>A table with two columns listing country codes and a language spoken in that country. The country code is USA for every row.</desc>
  <style>
    .lines {
      stroke: currentColor;
      stroke-width: 1.8;
    }
    .lines path {
      stroke-linecap: round;
      stroke-linejoin: round;
      fill: none;
    }
    .lines circle {
      fill: currentCol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 1.6l-2 2.5q-.8 1.1-1 2l.2 1.6q.2.7 2 1.3 2 .6 3.6.6 1.6.1 2.6-.5l1.3-.8m7.8-5.6q-.2-.5-.4.9l-.2 2.5v1.6l-.1 1q-.3 0 .3-1.6.5-1.6 1.2-3.1t1.3-2.3q.7-.8 1.4-1 .8-.2 1 .2l1 1.1.7 1m6.1-1.6v-.4h-.1q0 0 0 0t0 0l-.1.6-.3 6.4.1-.7.3-.6.2-.5.6-1.4.6-1.4.7-1.5q.6-1 1.7-1.3.5.4.6 5.4l.4-.8q.4-1.1 1-2 .6-1 1.2-1.5t1.3-.6q.8-.2 1 0 .4 0 .7.2l.3.2.2.1q.3.2 1 1.2.5 1-.3 5.7v.1l.1-.5v-.4q.1 0 0 0l.3-.2.3-.4m11-5.2l-.3-.4q-.1 0 0 0l-.1-.1q-.2-.2-1-.4-1-.1-1.6.2l-1 .5q-.3.2-1.1 1.4-1 1.2-1 2.4l-.3 2q0 .7 1 .7l1.5-.1q.6 0 1.4-.5l1.1-.5.7-.5q.3-.2 1.2-3.7 0 0 0 0l1 2.6q.5 1.6 1.1 2.5l1.1 1.1q.5.3.8.3.3 0 .4-.2l.3-.4.3-.6m6-6.9l-.1-.2h-.1l-.5 9 1.4-2.8q1.3-2.3 2.3-3.6l1.8-1.9q.8-.6 1.8-.8 1-.3 1.8 1t.5 7q0-.3.3-.6l.3-.5"/>
  </g>
</svg>

Grouping in SQL is closer to a process of sorting, then squishing or flattening. SQL calls this flattening [aggregation]. If every table has one and only one value per column then we need tell our query how to turn those multiple values into one.

Aggregation can take many forms. We're about to simply count up the number of rows, but you could also:

* Join each word together with commas: `English,Spanish,French`
* Get the biggest number: biggest of `1`, `6`, `2` = `6`
* Get an average of numbers: average of `1`, `6`, `2` = `3`

There are [lots of ways][aggregate-functions] to combine rows together based on your needs.

[aggregation]: https://www.postgresql.org/docs/current/tutorial-agg.html
[aggregate-functions]: https://www.postgresql.org/docs/current/functions-aggregate.html

## Picking Favorites

Before we start grouping we need to decide which columns to flatten, and which columns to `GROUP BY`. Both types of columns go in the `SELECT` clause. For this query, we're going to use `countrycode` and `language`.

The grouped columns will, by definition, be the same value so we don't have to decide how to combine (aggregate) them. Multiple `countrycode` values will all merge together into the same value.

> It's worth noting that you can also group by _multiple_ columns. An example would be grouping people by current country and language spoken. E.g. you don't want everyone from Andorra in one group. Instead you want everyone who can speak Spanish, Catalan, and Portuguese from Andorra in distinct groups.

The remaining, ungrouped columns will need to use an aggregate function so they know how to be merged together. **No other columns can be included** in the `SELECT` clause. If there are extra columns you'll see this error message:

> column "language" must appear in the GROUP BY clause or be used in an aggregate function

In our example we want to group everything by the `countrycode` and aggregate the number of languages. Our query looks like this:

```sql
SELECT
  countrycode,
  language -- this will need some kind of aggregate function
FROM countrylanguage
GROUP BY countrycode;
```

For our query, we want to know the number of languages per country, so we will use the `COUNT` function.

```sql
SELECT
  countrycode,
  COUNT(language)
FROM countrylanguage
GROUP BY countrycode;
```

<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="957.5 612.8 480 258">
  <title>Duplicated data in a languages table</title>
  <desc>A table with two columns listing country codes and a language spoken in that country. The country code is USA for every row.</desc>
  <style>
    .lines {
      stroke: currentColor;
      stroke-width: 1.8;
    }
    .lines path, .counted path {
      stroke-linecap: round;
      stroke-linejoin: round;
      fill: none;
    }
    .lines circle {
      fill: currentColor;
      stroke-width: 0.1;
    }
    .counted { stroke: #e7a3ff; }
    @media (prefers-color-scheme: dark) {
      .counted { stroke: #745280; }
    }
  </style>
  <g class="counted">
    <path stroke-width="23.2" d="M1363.7 698h-.4q.6.2.1.1h4l1.6-.4.7-.3q.2 0 0 0 0 0 0 0l.5-.2q.4 0 1-.3.6-.1.4 0l1.1-.3 2.8-.6 1.9-.4h6l.6.2h.2q0 0 0 0 .1.1 0 0l.4.2.8.4.6.6.4.4q0 0 0 0l.3.3.5.7.5 1q.4.6.7 1.8l.3 1.8.1 1.5.2 1.3.1.6.1 1.8q0 1.5-.2 2.5l-.3 1.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one more time step-by-step:

1. Start with the full, ungrouped table.
* Sort all the rows together based on the `GROUP BY` columns. So in our example: move all the `USA` rows together, and then all the `TUV` rows, and so on.
* For each group
  1. All of the columns specified in the `GROUP BY` clause are already the same so they simply collapse down into that value.
  * For the other columns, they get combined based on the aggregate function. In our case, we `COUNT` each row that exists and display the final number.

`GROUP BY` is such a useful feature of SQL, but it's not always intuitive the first few times you use it. My hope is that these mental models will serve you in your SQL travels. Good luck!

[part-1]: https://thoughtbot.com/blog/understanding-sql-basics
[part-2]: https://thoughtbot.com/blog/understanding-sql-join
