--1
--1)
CREATE TABLE EMPIDX AS SELECT * FROM EMP;
--2)
CREATE INDEX IDX_EMPIDX_EMPNO ON EMPIDX (EMPNO);
--3)
SELECT * FROM EMPIDX;
--2
CREATE OR REPLACE VIEW EMPIDX_OVER15K
AS (SELECT EMPNO, ENAME, JOB, DEPTNO,
SAL, NVL2(COMM, 'O', 'X') AS COMM
FROM EMPIDX
WHERE SAL > 1500);
SELECT * FROM EMPIDX_OVER15K;
--3
--1)
CREATE TABLE DEPTSEQ AS SELECT * FROM DEPT;
--2)
CREATE SEQUENCE SEQ_DEPTSEQ
INCREMENT BY 1
START WITH 1
MAXVALUE 99
MINVALUE 1
NOCYCLE NOCACHE;
SELECT SEQ_DEPTSEQ.NEXTVAL FROM DUAL;
--3)
INSERT INTO DEPTSEQ(DEPTNO,DNAME,LOC)
VALUES (1,'DATABASE','SEOUL');
INSERT INTO DEPTSEQ(DEPTNO,DNAME,LOC)
VALUES (2,'WEB','BUSAN');
INSERT INTO DEPTSEQ(DEPTNO,DNAME,LOC)
VALUES (3,'MOBILE','ILSAN');
SELECT * FROM DEPTSEQ;
'오라클 SQL' 카테고리의 다른 글
오라클 SQL 19강 (0) | 2021.03.04 |
---|---|
오라클 SQL 15~16강 (0) | 2021.03.04 |
오라클 SQL 13~14강 (0) | 2021.03.03 |
오라클 SQL 12강 연습문제 (0) | 2021.03.02 |
오라클 SQL 12강 (0) | 2021.03.02 |