Grouping Data

SELECT
    Continent,
    COUNT(*) AS CountriesCount
FROM country
GROUP BY Continent
HAVING COUNT(*) > 20


Continent CountriesCount
Asia 51
Europe 46
North America 37
Africa 58
Oceania 28

HAVING is very similar to WHERE. In fact, all types of WHERE clauses you learned about thus far can also be used with HAVING. The only difference is that WHERE filters rows and HAVING filters groups.