정렬을 하려고 하는데 정렬이 안되고 오류가 나네요 0 4 151

by neuclear [SQL Query] [2020.03.26 14:24:27]


캡처.PNG (1,826Bytes)

SELECT * FROM SEAT;
CREATE SEQUENCE SEQ_A1 START WITH 1 INCREMENT BY 1 NOCACHE;

INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A1');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A2');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A3');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A4');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A5');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A6');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A7');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A8');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A9');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_S1.NEXTVAL, 1, 'A10');
COMMIT;

INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A1');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A2');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A3');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A4');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A5');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A6');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A7');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A8');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A9');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 2, 'A10');
COMMIT;

INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A1');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A2');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A3');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A4');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A5');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A6');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A7');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A8');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A9');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 3, 'A10');
COMMIT;

INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A1');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A2');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A3');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A4');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A5');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A6');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A7');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A8');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A9');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 4, 'A10');
COMMIT;

INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A1');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A2');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A3');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A4');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A5');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A6');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A7');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A8');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A9');
INSERT INTO SEAT(SCODE, THCODE, SNAME) VALUES (SEQ_A1.NEXTVAL, 5, 'A10');
COMMIT;

SELECT * FROM SEAT WHERE ORDER BY SCODE ASC;

이런식으로 테이블에 정보를 넣어두고 SCODE에 대해 오름차순으로 정렬을 하려 하는데 

사진과 같이 오류가 나네요,

by pajama [2020.03.26 14:28:09]

WHERE 절에 조건이 없네요..?


by neuclear [2020.03.26 14:37:16]

ORDER BY가 조건이 아니었나요?


by 마농 [2020.03.26 14:48:20]

by neuclear [2020.03.26 14:54:23]

아 감사합니다.

 

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입