What is the difference between HAVING and WHERE in SQL SERVER?

HAVING and WHERE  are the clauses which are used to filter the data in a select quey.

Some differences between HAVING and WHERE clauses are:

  • HAVING is generally used along with the group by clause. WHERE clause is used independently.
  • Purpose of the HAVING clause is to work on the aggregate functions. WHERE clause can be used without aggregate functions also.
  • HAVING behaves similar to WHERE clause if there is no GROUP BY in the Query.

This entry was posted in . Bookmark the permalink.

Leave a reply