Interview Preparation · DBMS and SQL
WHERE vs HAVING
Explanation
WHERE filters individual rows before grouping; HAVING filters groups after GROUP BY and can use aggregate functions.
Example
SELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5;