HAVING CLAUSE
and WHERE CLAUSE
is :HAVING CLAUSE
is used only with the SELECT
statement. It is generally used in a GROUP B
Y clause in a query.GROUP BY
is not used, HAVING
works like a WHERE
clause. HAVING
clause can be used with the aggregate function.SELECT expr1, expr2, expr3..,
FROM tables
WHERE condition
GROUP BY expr1, expr2, expr3..,
HAVING condition;
WHERE
clause is applied to each row before they become a part of the GROUP BY
function in a query. 'WHERE
' clause cannot use with the aggregate function.WHERE condition;