HAVING Clause

HAVING filters grouped records. It's like WHERE, but for aggregates.

SELECT department, COUNT(*) AS total
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

This returns only departments with more than 5 employees.

← PrevNext →