HAVING filters grouped records. It's like WHERE, but for aggregates.
HAVING
WHERE
SELECT department, COUNT(*) AS total FROM employees GROUP BY department HAVING COUNT(*) > 5;
This returns only departments with more than 5 employees.