Skip to main content
SQL • LESSON 73

HAVING

How can we keep only departments with many employees?

Intermediate3 Minutes860 XP
🤔 THE QUESTION

How can we keep only departments with many employees?

💡 WHAT IS IT?

The HAVING clause filters aggregated groups after the GROUP BY operation has executed.

🎯 WHAT IS IT USED FOR?

Filtering high-volume categories, identifying large teams, post-aggregation thresholds.

💻 EXAMPLE
SELECT department, COUNT(*) AS employee_count
FROM employees
GROUP BY department
HAVING COUNT(*) > 10;

🎯 Mission Objectives

Practice typing production-grade SQL code for HAVING.

  • HAVING clause
  • Post-aggregation filter
  • Group thresholding
  • HAVING COUNT