I did not know that having can be used without group by in the select list.
But Oracle docs made it clear that having can work without group by also.
The HAVING clause is applied to each group of the grouped table, much as a WHERE clause is applied to a select list. If there is no GROUP BY clause, the HAVING clause is applied to the entire result as a single group.
create table gotcha(id number);
insert into gotcha values(1);
insert into gotcha values(2);
insert into gotcha values(1);
select count(*)
from gotcha
having count(*) > 3;
no rows selected
select count(*)
from gotcha
having count(*) >2
count(*)
----------
3
Tea Addict, Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer, Oracle Web Service Developer