HAVING

HAVING filters groups after grouping, generally on the result of an aggregate, whereas WHERE filters rows before. A condition on an individual row goes in WHERE, which is more efficient, and a condition on an aggregate in HAVING.

Example

SELECT pays, COUNT(*) FROM clients GROUP BY pays HAVING COUNT(*) > 100;

Related concepts

The whole glossary