HAVING clause filters groups after aggregation, while WHERE clause filters individual rows before grouping. HAVING is used to specify conditions on the groups created by GROUP BY, such as showing only categories with total sales above a threshold. WHERE cannot be used with aggregate functions, whereas HAVING can.