HAVING Clause Examples

SQL statement

Description

 

SELECT Title, Count(Title)
FROM Employees
WHERE Department = 'Production'
GROUP BY Title HAVING Count(Title) > 50;

Displays the job titles in the Production department assigned to more than 50 employees

SELECT Department, Count(Department)
FROM Employees
GROUP BY Department
HAVING Count(Department) > 100;

Displays departments with more than 100 employees