1. WHERE clause can be used with a Select, Update and Delete Statement Clause but
the HAVING clause can be used only with a Select statement.
2. We can’t use an aggregate functions in the WHERE clause unless it is in a sub-query
contained in a HAVING clause whereas we can use an aggregate function in the
HAVING clause. We can use a column name in the HAVING clause but the column
must be contained in the group by clause.
3. WHERE is used before the GROUP BY clause whereas a HAVING clause is used to
impose a condition on the GROUP Function and is used after the GROUP BY clause in
the query.
4. A WHERE clause applies to each and every row whereas a HAVING clause applies to
summarized rows (summarized with GROUP BY).
5. In the WHERE clause the data that is fetched from memory depending on a
condition whereas in HAVING the completed data is first fetched and then separated
depending on the condition.
What is the difference between the “WHERE” clause and the “HAVING” clause?
Gautam Sarswat Changed status to publish January 11, 2023
Posted
in
by
Tags:
Leave a Reply