Where And Having Clause Difference in SQL


  • Having is used only with the SELECT statement but WHERE clause can be used with Select, Update and Delete statement.
  • Having Clause is used to filter group while WHERE clause is used to filter rows.
  • WHERE clause is used to fetch particular records and this clause is applied after select statement but having clause is used for combination of group by functions.
  • Having clause is typically used in GROUP BY clause, without using GROUP BY function  you can not write the having clause.
  • Having clause works only to columns that also appear in the Group by clause or in an aggregate function.
  • Where clause is applied prior the grouping of data, while having clause is specified after grouping the result of the data.