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



Пример 15.10.1


SELECT DEPT.DEPT_NO, AVG (EMP.EMP_SAL)

FROM DEPT, EMP

WHERE DEPT.DEPT_NO = EMP.DEPT_NO

GROUP BY DEPT.DEPT_NO

HAVING NOT EXISTS (SELECT EMP1.DEPT_NO

FROM EMP EMP1

WHERE EMP1.DEPT_NO <> DEPT.DEPT_NO

GROUP BY EMP1.DEPT_NO

HAVING AVG (EMP1.EMP_SAL)= AVG (EMP.EMP_SAL));




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