Filtering Groups with HAVING in MySQL

Published July 26, 2025 By Sai Sree Ram Gundepudi

Example

SELECT department_id, COUNT(*) AS emp_count FROM employees GROUP BY department_id HAVING COUNT(*) > 5;

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article