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



Пример 15.8.1


SELECT EMP_NAME, (SELECT COUNT(*)

FROM EMP EMP1

WHERE EMP1.DEPT_NO = EMP.DEPT_NO

AND EMP1.EMP_NAME = EMP.EMP_NAME

AND EMP1.EMP_NO <> EMP.EMP_NO) + 1

FROM EMP

WHERE (SELECT COUNT(*)

FROM EMP EMP1

WHERE EMP1.DEPT_NO = EMP.DEPT_NO

AND EMP1.EMP_NAME = EMP.EMP_NAME

AND EMP1.EMP_NO <> EMP.EMP_NO) > 1

AND EMP_NAME LIKE (SELECT EMP1.EMP_NAME

FROM EMP EMP1, DEPT

WHERE EMP.DEPT_NO = DEPT.DEPT_NO

AND EMP1.EMP_NO = DEPT.DEPT_MNG) || '%';




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