Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

DDL, DCL 문을 작성할때는 :로 시작하는 변수를 하나 만들고 리소스를 저장합니다.

아래 처럼 실행할 수 있습니다.

예제쿼리

CREATE TABLE HR.emp
(
empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2)
);

ALTER TABLE HR.emp ADD CONSTRAINT emp_pk PRIMARY KEY (empno);

CREATE INDEX HR.emp_idx01 ON HR.emp(job, deptno);

COMMENT ON COLUMN HR.emp.empno IS '사원번호';
COMMENT ON COLUMN HR.emp.ename IS '성명';
COMMENT ON COLUMN HR.emp.job IS '직군';
COMMENT ON COLUMN HR.emp.mgr IS '직속상사';
COMMENT ON COLUMN HR.emp.hiredate IS '입사일';
COMMENT ON COLUMN HR.emp.sal IS '급여';
COMMENT ON COLUMN HR.emp.comm IS '보너스';
COMMENT ON COLUMN HR.emp.deptno IS '부서코드';

INSERT INTO HR.emp VALUES(7839, 'KING', 'PRESIDENT', NULL, TO_DATE('1981-11-17', 'yyyy-mm-dd'), 5000, NULL, 10);
INSERT INTO HR.emp VALUES(7698, 'BLAKE', 'MANAGER', 7839, TO_DATE('1981-05-01', 'yyyy-mm-dd'), 2850, NULL, 30);
INSERT INTO HR.emp VALUES(7782, 'CLARK', 'MANAGER', 7839, TO_DATE('1981-06-09', 'yyyy-mm-dd'), 2450, NULL, 10);
INSERT INTO HR.emp VALUES(7566, 'JONES', 'MANAGER', 7839, TO_DATE('1981-04-02', 'yyyy-mm-dd'), 2975, NULL, 20);

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.