Решения практических упражнений дисциплины "Теория экономических информационных систем", страница 4

SELECT          E.ENAME,

                        Е .JOB,

                        E.SAL,

                        S. GRADE,

                        D. DNAME

FROM             EMP Е,

                        SALGRADE S,

                        DEPT D

WHERE          E.DEPTNO = D.DEPTNO

AND                E.SAL BETWEEN S.LOSAL AND S.HISAL

AND                E.JOB != 'CLERK'

ORDER BY     E.SAL DESC;

Результат

Server: Msg 107, Level 16, State 2, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

Server: Msg 107, Level 16, State 1, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

Server: Msg 107, Level 16, State 1, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

Server: Msg 107, Level 16, State 1, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

Server: Msg 107, Level 16, State 1, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

Server: Msg 107, Level 16, State 1, Line 110

The column prefix 'E' does not match with a table name or alias name used in the query.

SELECT          E.ENAME,

                        E.JOB,

                        E.SAL* 12 ANNUAL_SAL,

                        D.DEPTNO,

                        D. DNAME,

                        S. GRADE

FROM             EMP Е, SALGRADE S, DEPT D

WHERE          E.DEPTNO = D.DEPTNO

AND                E.SAL BETWEEN S.LOSAL AND S.HISAL

AND                (E.SAL*12 + NVL(E.COMM,0)= 36000

OR                              E.JOB = 'CLERK')

ORDER BY     E.JOB;

Результат

Server: Msg 195, Level 15, State 10, Line 119

'NVL' is not a recognized function name.

SELECT          E.ENAME EMPLOYEE,

                                    E.HIREDATE,

                                    M.ENAME MANAGER,

                                    M.HIREDATE

FROM             EMP E, EMP M

WHERE          E.MGR = M.EMPNO

AND        E.HIREDATE < M.HIREDATE;

Результат

Без ошибок

SELECT          DEPTNO, DNAME

FROM             DEPT

MINUS

SELECT          D.DEPTNO, D. DNAME

FROM             DEPT D, EMP E

WHERE          D.DEPTNO = E .DEPTNO

Результат

Без ошибок

Решения упражнений: урок 8

SELECT          JOB, ENAME, SAL

FROM             EMP

WHERE          ( SAL, JOB) IN

                                                      (SELECT             MAX (SAL), JOB

                                                      FROM                 EMP

                                                      GROUP BY          JOB)

ORDER BY    SAL DESC;

Результат

Server: Msg 170, Level 15, State 1, Line 112

Line 112: Incorrect syntax near ','.

SELECT          ENAME, JOB, SAL

FROM             EMP

WHERE          (SAL, JOB) IN

                                         (SELECT               MIN (SAL), JOB

                                          FROM                  EMP

                                          GROUP BY          JOB)

ORDER BY     SAL;

Результат

Server: Msg 170, Level 15, State 1, Line 112

Line 112: Incorrect syntax near ','.

SELECT          DEPTNO, ENAME, HIREDATE

FROM             EMP

WHERE          (HIREDATE, DEPTNO) IN

                                    (SELECT        MAX (HIREDATE), DEPTNO

                                     FROM           EMP

                                     GROUP BY   DEPTNO)

ORDER BY     HIREDATE;

Результат

Server: Msg 170, Level 15, State 1, Line 112

Line 112: Incorrect syntax near ','.

            SELECT         ENAME, SAL SALARY, DEPTNO

FROM             EMP E

WHERE          SAL < (SELECT         AVG (SAL)

                                               FROM             EMP

                                               WHERE          DEPTNO = E .DEPTNO)

ORDER BY     DEPTNO;