Результат:
Без ошибок
COLUMN AVERAGE FORMAT 9999
Результат:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'COLUMN'.
SELECT EMP.EMPNO,
ENAME,
JOB,
SAL,
HIREDATE,
MINIMUM,
MAXIMUM,
AVERAGE
FROM EMP .AGGREGATES AGG
WHERE EMP.DEPTNO = AGG.DEPTNO
AND EMP.EMPNO = &EMPNO;
Результат:
Server: Msg 170, Level 15, State 1, Line 11
Line 11: Incorrect syntax near '&'.
SELECT *
FROM USER_VIEWS
WHERE VIEW_NAME = ' AGGREGATES ';
Результат:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'USER_VIEWS'.
CREATE VIEW MY_DEPT
AS
SELECT EMPNO,
ENAME NAME,
JOB,
HIREDATE,
SAL SALARY,
COMM COMMISSION
FROM EMP
WHERE DEPTNO = 30
AND JOB != 'MANAGERS’;
SELECT *
FROM MY_DEPT;
Результат:
Server: Msg 105, Level 15, State 1, Procedure MY_DEPT, Line 11
Unclosed quotation mark before the character string 'MANAGERS’
'.
Server: Msg 170, Level 15, State 1, Procedure MY_DEPT, Line 11
Line 11: Incorrect syntax near 'MANAGERS’
'.
CREATE VIEW JOBS
AS
SELECT JOB,
COUNT ( * ) COUNT_JOBS
FROM EMP
GROUP BY JOB;
COL ENAME HEADING 'Name'
COL JOB HEADING 'Jоb'
COL COUNT HEADING 'Total Employees I With This Job'
SELECT E .ENAME ENAMЕ,
E.JOB JOB,
J .COUNT_JOBS COUNT
FROM EMP E, JOBS J
WHERE E.JOB = J .JOB;
Результат:
Server: Msg 170, Level 15, State 1, Procedure JOBS, Line 9
Line 9: Incorrect syntax near 'COL'.
CREATE VIEW JOB_STATS
AS
SELECT D.DNAME DEPARTMENT,
E .JOB,
COUNT (E.EMPNO) NO_OF_EMPS,
AVG (E. SAL) AVG_SAL
FROM DEPT D, EMP E
WHERE D.DEPTNO = E.DEPTNO(+)
GROUP BY D.DNAME, E .JOB;
SELECT * FROM JOB_STATS;
Результат:
Server: Msg 170, Level 15, State 1, Procedure JOB_STATS, Line 8
Line 8: Incorrect syntax near ')'.
Решение упражнений: урок 17
INSERT INTO COMPANY_CARS
VALUES
('&CHASSIS_NUMBER',
‘&MAKE ',
'&MODEL',
&CUBIC_CAPACITY,
'&COLOUR',
'&DATE_OF_REGISTRATION',
'®_NO',
&EMPNO,
&DEPTNO,
' &COMMENTS ' ) ;
Результат:
Server: Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near '&'.
SAVE INSERT_SQL
Результат:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'INSERT_SQL'.
INSERT INTO COMPANY_CARS
VALUES
(cc_sequence. nextval,
' &MAKE ',
'&MODEL',
&CUBIC_CAPACITY,
'&COLOUR',
'&DATE_OF_REGISTRATION',
' ®_NO ',
' &EMPNO,
&DEPTNO,
' &COMMENTS ');
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.