Введение в модель данных SQL



Пример 15.7


SELECT DEPT.DEPT_NO

FROM DEPT, EMP

WHERE DEPT.DEPT_NO = EMP.DEPT_NO

GROUP BY DEPT.DEPT_NO

HAVING AVG(EMP.EMP_SAL) IN

(SELECT MAX(EMP1.EMP_SAL)

FROM EMP, DEPT DEPT1

WHERE EMP.DEPT_NO = DEPT1.DEPT_NO

AND DEPT1.DEPT_NO <> DEPT.DEPT_NO

GROUP BY DEPT.DEPT_NO);




Содержание  Назад  Вперед