Friday, July 4, 2014

SQL Difference between Where And Having Clause

  • WHERE clause can be used with Select, Insert and Update statements, whereas HAVING clause can only be used with the Select statement
  • WHERE filters rows before aggregation (GROUPING), where as HAVING filters group, after the aggregation are performed
  • Aggregate functions cannot be used in the WHERE clause, unless it is in a sub query contained in a HAVING clause, whereas, aggregate functions can be used in HAVING clause
I hope it was informative for you and I would like to thank you for reading