How can we find active departments with more than ten employees?
The complete aggregation pipeline filters rows with WHERE, groups them with GROUP BY, and filters groups with HAVING.
Complex business reports, active team sizing, robust data analytics workflows.
SELECT department, COUNT(*) AS active_employees
FROM employees
WHERE status = 'Active'
GROUP BY department
HAVING COUNT(*) > 10;Practice typing production-grade SQL code for WHERE + GROUP BY + HAVING.