HAVING Clause
The HAVING clause operates exactly as a WHERE clause, although it operates on the output of a GROUP BY. It supports the same syntax as the WHERE clause.
Syntax Rules
-
Expressions used in the GROUP BY clause must contain either an aggregate function (COUNT, AVG, SUM, MIN, MAX), or be one of the grouping expressions.