Back to search

HAVING vs WHERE in SQL

WHERE filters rows before grouping, while HAVING filters groups after aggregation.

SQL Easy Theory

HAVING vs WHERE in SQL

WHERE filters rows before grouping, while HAVING filters groups after aggregation.

  • WHERE happens earlier
  • HAVING works on grouped results
  • Common with aggregate conditions

HAVING vs WHERE in SQL