Tuesday, December 18, 2012

Differences between where clause and having clause

Scenario:

Differences between where clause and having clause

Solution:

Where clause
Having clause
Both where and having clause can be used to filter the data.
Where as in where clause it is not mandatory.
But having clause we need to use it with the group by.
Where clause applies to the individual rows.
Whereas having clause is used to test some condition on the group rather than on individual rows.
Where clause is used to restrict rows.
But having clause is used to restrict groups.
Restrict normal query by where
Restrict group by function by having
In where clause every record is filtered based on where.
In having clause it is with aggregate records (group by functions).

No comments:

Post a Comment

Thank you :
- kareem