GROUP BY groups rows for aggregation. HAVING filters groups after aggregation (while WHERE filters rows before grouping). Example: “only groups with count > 10”.
SELECT country, COUNT(*) AS cnt FROM users GROUP BY country HAVING COUNT(*) > 10;