SQL HAVING

To filter the records just like WHERE clause, HAVING clause is used. 

HAVING clause is used with aggregate functions because with aggregate functions WHERE clause can’t be used.  

Syntax:

SELECT * FROM table_name
WHERE condition
GROUP BY column_name(s)
HAVING condition;

Example: To fetch Roll_No and and name from the table students

SELECT Roll_No, Name FROM students;

This will fetch the whole table as below: