The WHERE clause filters rows before grouping – that is, before they’re included in the result set. Filtering is also based on certain conditions.
The HAVING clause, on the other hand, filters data post-grouping – meaning after aggregation.