Filters rows produced by GROUP BY that do not satisfy a predicate.
Syntax¶SELECT ... FROM ... GROUP BY ... HAVING <predicate> [ ... ]
Copy
Parameters¶predicate
The condition specified by the HAVING clause applies to expressions produced by the GROUP BY. Therefore, the same restrictions that apply to GROUP BY expressions also apply to the HAVING clause. The predicate can only refer to:
Expressions in the SELECT list can be referred to by the column alias defined in the list.
Find the departments that have fewer than 10 employees:
SELECT department_id FROM employees GROUP BY department_id HAVING count(*) < 10;Copy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4