The HAVING clause is used in combination with the GROUP BY clause and the SQL aggregate functions. HAVING clause allows us to call the data conditionally on the column that return from using the SQL aggregate functions.
The SQL HAVING syntax is simple and looks like this:
SELECT [COLUMN NAME 1] , AGGREGATE FUNCTION ( [COLUMN NAME 2] )
Letís say, we want to get the departments from GameScores that total scores is more than 4000.
SQL statement :
SELECT Department, SUM(Scores)