In this article, we will learn how to use the HAVING clause in SQL.
SELECT column_name(s) FROM TABLE_NAME GROUP BY column_name(s) HAVING condition;
The subsequent statement would list the number of viewers in each city. Only include cities with more than 5 viewers:
SELECT COUNT(ID), City FROM Viewers GROUP BY City HAVING COUNT(ID) > 5;
Also, check How To Use GROUP BY Keyword In SQL