What Is The Difference Between Where & Having Clause?


2 Answers

Muddassar Memon Profile
Muddassar Memon answered
The difference between a "where" clause and a "having" clause is a "Where" clause is applied to enforce condition on select statement and a single row function and is applied prior to GROUP BY clause where as HAVING clause is applied to enforce condition of GROUP Function and is applied after GROUP BY clause in the inquiry.

When you are carrying out a summary query, you can also state a Having clause. This is similar to a Where clause, the only difference is it involves a summary value, in place of a column value.

The most basic way to understand the difference among a "Where" clause is a "Where" clause denotes the rows in your tables which have to be integrated in the summation. The "Having" clause operates after the summation has been carried out. It denotes which of the summary row are returned in your resultset.
Anonymous Profile
Anonymous answered
The difference is that WHERE operates on individual rows, while HAVING operates on groups.

You can have WHERE without HAVING, you can have HAVING without WHERE, you can have both WHERE and HAVING, and you can have neither WHERE nor HAVING. But you can't have HAVING without grouping, even if the group consists of the entire result set.

Answer Question