Skip to main content
SQL โ€ข LESSON 74

HAVING with AVG

How can we find departments with high average salaries?

Intermediateโฑ 3 Minutesโญ 870 XP
๐Ÿค” THE QUESTION

How can we find departments with high average salaries?

๐Ÿ’ก WHAT IS IT?

HAVING filters groups based on aggregate statistical outcomes such as AVG(), SUM(), or MAX().

๐ŸŽฏ WHAT IS IT USED FOR?

Identifying high-compensation divisions, flagging high-error service clusters.

๐Ÿ’ป EXAMPLE
SELECT department, AVG(salary) AS average_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 90000;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for HAVING with AVG.

  • โœ“ HAVING AVG
  • โœ“ Statistical threshold
  • โœ“ Group filtering
  • โœ“ High-compensation groups