The Having Clause





In a similar manner the other aggregrate functions can be used. just as you can
select specific rows with a WHERE clause, you can select specific groups with
a HAVING clause. Place the HAVING clause in your query after the GROUP BY clause.
To list the annual average salary for all job groups consisting of more than
one employee, enter:
SQL > SELECT JOB, COUNT(*.), 12* AVG(PAY)
2 FROM EMP
3 GROUP BY JOB
4 HAVING COUNT(*)> 1;
Domain Name Search
|