Oracle HAVING

The Oracle HAVING clause restricts the rows of a GROUP BY clause.

Oracle HAVING example

Select 
c.name, sum(c.income) AS "Total Income"
From customers c 
Group By c.name
Having sum(c.income) > 50;

Select 
c.name, sum(c.income) AS "Total Income"
From customers c
Where c.type = 'CORPORATE' 
Group By c.name
Having sum(c.income) < 50 OR sum(c.income) > 60;

Select name, avg(income) 
From customers  
Group By name
Having sum(income) <
(Select max(income)
From customers
Group By name