In this article, we will cover these PostgreSQL clauses with examples: HAVING, LIMIT and FETCH. In a previous article we discussed the WHERE, ORDER BY and GROUP BY clauses. Click the link if you wish to learn about those clauses.
The HAVING clause works on grouped data returned by a GROUP BY. The HAVING clause has a different role to play in a SQL query from the WHERE clause; here’s how:
The HAVING clause works on a group of rows whereas the WHERE clause works on individual rows. Aggregate Functions, like Sum(), Min(), Max(), etc., can be