WHERE filters rows returned by SELECT statements, while HAVING filters rows returned by an aggregation operation.