Discussion about SQL queries

What is the difference between 'Where' and 'Having 'clause?

What is the difference between 'Where' and 'Having 'clause?

by Palash Mandal -
Number of replies: 0

row only whereas Having clause is used in column operations and it is generally applied on summarized data and groups.

In where clause, the desired data is fetched according to the applied condition. In contrast, having clause fetches the whole data then separation is made based on the condition.

Aggregate functions like min, max, avg, sum, the count can never appear with Where clause while all of these can be used along Having Clause.

We cannot use the Having Clause without a SELECT statement. Conversely, we can use Where clause with SELECT, Update or Delete statements.

Where clause usually behaves as the pre-filter while having clause behaves like a post-filter.