Difference between HAVING and WHERE clause in SQL

HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.

HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *