Skip to main content
SQL • LESSON 74

HAVING with AVG

How can we find departments with high average salaries?

Intermediate3 Minutes870 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