# GROUP BY

*noun*

say it: **“GROOP BY”** **/ɡruːp baɪ/**

The part of a query that puts rows with the same values together, so aggregate functions give one result per group.

## What is **GROUP BY** in a relational database?

**GROUP BY** — A clause collecting rows with equal grouping values so each group produces one result row.

```sql
SELECT customer_id, COUNT(*) AS order_count
FROM purchase_order
GROUP BY customer_id;
```

## In a sentence

- “**GROUP BY** Country gives one row per country with its customer count.”

Level: Apprentice · [More SQL terms at this level](https://www.ask-codey.com/glossary?category=sql&level=2)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/group-by
