HAVING CLAUSE
- HAVING CLAUSE is used only with the SELECT statement.
- It is generally used in a GROUP BY clause in a query.
- If GROUP BY is not used, HAVING works like a WHERE clause.
- It is generally used in a GROUP BY clause in a query.
- If GROUP BY is not used, HAVING works like a WHERE clause.
WHERE Clause
- It is applied to each row before they become a part of the GROUP BY function in a query.
Where Clause | Having Clause |
WHERE clause can be used without GROUP BY clause. | HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. |
WHERE clause can not contain aggregate functions. | HAVING clause can contain aggregate functions. |
WHERE clause can operate individual row. | HAVING clause can operate group of row. |
It is more fast. | It is much slow. |
WHERE clause select rows before grouping. | HAVING clause select rows after grouping |
No comments:
Post a Comment