SQL • LESSON 11
HAVING
Learn how to filter grouped SQL results using the HAVING clause.
🟡 Intermediate⏱ 2 Minutes⭐ 190 XP
🤔 THE QUESTION
How can we find the highest and lowest salary in a table?
💡 WHAT IS IT?
MAX() returns the largest value and MIN() returns the smallest value from a column.
🎯 WHAT IS IT USED FOR?
They are useful for finding extremes such as highest salary, lowest price, latest date, earliest date, maximum score, or minimum value.
💻 EXAMPLE
SELECT
MAX(salary) AS highest_salary,
MIN(salary) AS lowest_salary
FROM employees;Mission Brief
Practice filtering grouped departments using HAVING and aggregate conditions.
Objectives
- ✓ SELECT
- ✓ COUNT
- ✓ FROM
- ✓ GROUP BY
- ✓ HAVING