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



Пример 15.9


SELECT DEPT.DEPT_NO

FROM DEPT, EMP

WHERE DEPT.DEPT_NO = EMP.DEPT_NO

GROUP BY DEPT.DEPT_NO

HAVING EXISTS (SELECT *

FROM EMP EMP1

WHERE EMP1.DEPT_NO <> DEPT.DEPT_NO

GROUP BY EMP1.DEPT_NO

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




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