SQL TUTORIALS-
SQL HAVING Clause
Introduction-
What is the SQL HAVING Clause? How to use the SQL HAVING clause with GROUP BY Clause
β In a Simple Word The HAVING clause in SQL is used to filter groups of rows created by the GROUP BY clause β similar to how WHERE filters individual rows...
SQL HAVING clause filters aggregated results after the GROUP BY operation is performed.
β Syntax Example -
SELECT column_name, AGGREGATE_FUNCTION(column_name)
FROM table_name
GROUP BY column_name
HAVING condition;
SQL WHERE clause Filters individual rows (before grouping).
| EmpID | Name | Department | Salary |
|---|---|---|---|
| 1 | ANNI | HR | 40000 |
| 2 | RAJ | HR | 45000 |
| 3 | POOJA | IT | 55000 |
| 4 | SUJAN | IT | 60000 |
| 5 | RUPESH | SALES | 30000 |
| 6 | SIMA | SALES | 32000 |