Difference between having and where clause:
“A query can contain both a WHERE clause and a HAVING clause.” WHERE comes 1st then Having comes if they are in one sql query."
Having clause:
- Operates on Groups.
- used only with the SELECT statement.
- Is used after GROUP BY clause.
Where clause:
- Operates on individual rows.
- Where Clause can be used other than Select statement also.
- Where is used before GROUP BY clause
Having clause is used only with group functions whereas Where is not used with.
ReplyDeletefor more sql interview question and answer please visit this link.