설치

Oracle XE 을 대상으로 진행되었습니다.

  1. 다운로드

    그림 : Oracle download
    Oracle download page
  2. Run

    그림 : SQL Command Line
    SQL Command Line
  3. 사용자 추가

    create user scott identified by tiger;
    grant resource, connect to scott;
    
    그림 : Oracle 사용자 추가
    add user
  4. create table

    connect scott/tiger
    
    CREATE TABLE DEPT (
        DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
        DNAME VARCHAR2(14) ,
        LOC VARCHAR2(13) 
    ) ;
    CREATE TABLE EMP (
        EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY,
        ENAME VARCHAR2(10),
        JOB VARCHAR2(9),
        MGR NUMBER(4),
        HIREDATE DATE,
        SAL NUMBER(7,2),
        COMM NUMBER(7,2),
        DEPTNO NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPT
    );
    
    insert into dept(deptno, dname, loc) values(10,'ACCOUNTING','NEW YORK');
    insert into dept(deptno, dname, loc) values(20,'RESEARCH','DALLAS');
    insert into dept(deptno, dname, loc) values(30,'SALES','CHICAGO');
    insert into dept(deptno, dname, loc) values(40,'OPERATIONS','BOSTON');
    
    insert into emp values(7782,'CLARK','MANAGER',7839,to_date('1981-06-09','yyyy-mm-dd'),2450,NULL,10);
    insert into emp values(7839,'KING','PRESIDENT',NULL,to_date('1981-11-17','yyyy-mm-dd'),5000,NULL,10);
    insert into emp values(7934,'MILLER','CLERK',7782,to_date('1982-01-23','yyyy-mm-dd'),1300,NULL,10);
    insert into emp values(7369,'SMITH','CLERK',7902,to_date('1980-12-17','yyyy-mm-dd'),800,NULL,20);
    insert into emp values(7566,'JONES','MANAGER',7839,to_date('1981-04-02','yyyy-mm-dd'),2975,NULL,20);
    insert into emp values(7788,'SCOTT','ANALYST',7566,to_date('1987-07-13','yyyy-mm-dd'),3000,NULL,20);
    insert into emp values(7876,'ADAMS','CLERK',7788,to_date('1987-07-13','yyyy-mm-dd'),1100,NULL,20);
    insert into emp values(7902,'FORD','ANALYST',7566,to_date('1981-12-03','yyyy-mm-dd'),3000,NULL,20);
    insert into emp values(7499,'ALLEN','SALESMAN',7698,to_date('1981-02-20','yyyy-mm-dd'),1600,300,30);
    insert into emp values(7521,'WARD','SALESMAN',7698,to_date('1981-02-22','yyyy-mm-dd'),1250,500,30);
    insert into emp values(7654,'MARTIN','SALESMAN',7698,to_date('1981-09-28','yyyy-mm-dd'),1250,1400,30);
    insert into emp values(7698,'BLAKE','MANAGER',7839,to_date('1981-05-01','yyyy-mm-dd'),2850,NULL,30);
    insert into emp values(7844,'TURNER','SALESMAN',7698,to_date('1981-09-08','yyyy-mm-dd'),1500,0,30);
    insert into emp values(7900,'JAMES','CLERK',7698,to_date('1981-12-03','yyyy-mm-dd'),950,NULL,30);