Oracle

Restricting Group Results

Figo Kim 2006. 8. 31. 12:46

Use WHERE clause to restrict the rows that you select.

Use HAVING clause to restrict groups.

SELECT department_id, AVG(salary)
FROM employees
WHERE AVG(salary)>8000
GROUP BY department_id;

==> This sql statement will generate an error at line 3.
==> WHERE should be HAVING