# HAVING

*noun*

say it: **“HAV-ing”** **/ˈhævɪŋ/**

The part of a query that filters groups after GROUP BY, using aggregate values.

## What is **HAVING** in a relational database?

**HAVING** — A clause filtering groups after grouping and aggregation.

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

## In a sentence

- “**HAVING** COUNT(\*) > 5 keeps only countries with more than five customers.”

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/having
