SQL

HAVING Clause

English

Overview

A clause that filters grouped results.

Details

A clause that filters results aggregated by GROUP BY based on a condition over the aggregate values, applied at a different point than WHERE. The key difference is timing: WHERE filters individual rows before grouping, while HAVING filters the groups after aggregation -- only HAVING can use a condition on an aggregate result, like SUM(price) > 1000.

More Database terms