Difference between Where and Having clause



Where vs Having




Where Clause Having Clause
WHERE clause can be used with
• SELECT
• INSERT
• UPDATE
• DELETE
Having clause can only be used with only SELECT
With other DDL commands you will get incorrect syntax error
WHERE clause is used for filtering rows and it applies on each and every row HAVING clause is used to filter groups in SQL.
WHERE clause can be used before or after GROUP BY clause HAVING clause is used after GROUP BY clause.
We can't use aggregate functions in the where clause unless it is in a sub query contained in a HAVING clause. We can use aggregate function in HAVING clause


Frequently Used Queries In SQL Server

3 comments:
Write comments

Please do not enter spam links

Meet US

Services

More Services