Search notes:

Oracle SQL: HAVING clause

The having clause allows to formulate rules which specify which aggregated rows are returned.
With 21c, macros for scalar expressions can be used inside the having clause.

Order of GROUP BY and HAVING clause

When combining group by with having, the order in which these clauses appear is unimportant. Both of the following two queries are equivalent:
select
   sum(num)  sum_num,
   txt
from
   tq84_tab
group by
   txt
having
   sum(num) > 0;


select
   sum(num)  sum_num,
   txt
from
   tq84_tab
having
   sum(num) > 0
group by
   txt;

See also

In order for a materialized view to be fast refreshable, the query must not have a having clause.

Index