본문 바로가기
Dev./Back-end

Oracle 연습문제 . 데이터입력

by 돌도르 2012. 9. 24.
728x90

오라클 SQL 시험문제.docx


CREATE TABLE EMP

       (EMPNO NUMBER(4) NOT NULL PRIMARY KEY,

        ENAME VARCHAR2(10),

        JOB VARCHAR2(9),

        HIREDATE DATE,

        SAL NUMBER(7, 2),

        COMM NUMBER(7, 2),

        DEPTNO NUMBER(2));



INSERT INTO EMP VALUES

        (7369, 'SMITH',  'CLERK',

        TO_DATE('17-12-1980', 'DD-MM-YYYY'),  800, NULL, 20);

INSERT INTO EMP VALUES

        (7499, 'ALLEN',  'SALESMAN',

        TO_DATE('20-02-1981', 'DD-MM-YYYY'), 1600,  300, 30);

INSERT INTO EMP VALUES

        (7521, 'WARD',   'SALESMAN',

        TO_DATE('22-02-1981', 'DD-MM-YYYY'), 1250,  500, 30);

INSERT INTO EMP VALUES

        (7566, 'JONES',  'MANAGER',

        TO_DATE('2-04-1981', 'DD-MM-YYYY'),  2975, NULL, 20);

INSERT INTO EMP VALUES

        (7654, 'MARTIN', 'SALESMAN',

        TO_DATE('28-09-1981', 'DD-MM-YYYY'), 1250, 1400, 30);

INSERT INTO EMP VALUES

        (7698, 'BLAKE',  'MANAGER',

        TO_DATE('1-05-1981', 'DD-MM-YYYY'),  2850, NULL, 30);

INSERT INTO EMP VALUES

        (7782, 'CLARK',  'MANAGER',

        TO_DATE('9-06-1981', 'DD-MM-YYYY'),  2450, NULL, 10);

INSERT INTO EMP VALUES

        (7788, 'SCOTT',  'ANALYST',

        TO_DATE('09-12-1982', 'DD-MM-YYYY'), 3000, NULL, 20);

INSERT INTO EMP VALUES

        (7839, 'KING',   'PRESIDENT',

        TO_DATE('17-11-1981', 'DD-MM-YYYY'), 5000, NULL, 10);

INSERT INTO EMP VALUES

        (7844, 'TURNER', 'SALESMAN',

        TO_DATE('8-09-1981', 'DD-MM-YYYY'),  1500,    0, 30);

INSERT INTO EMP VALUES

        (7876, 'ADAMS',  'CLERK',

        TO_DATE('12-01-1983', 'DD-MM-YYYY'), 1100, NULL, 20);

INSERT INTO EMP VALUES

        (7900, 'JAMES',  'CLERK',

        TO_DATE('3-12-1981', 'DD-MM-YYYY'),   950, NULL, 30);

INSERT INTO EMP VALUES

        (7902, 'FORD',   'ANALYST',

        TO_DATE('3-12-1981', 'DD-MM-YYYY'),  3000, NULL, 20);

INSERT INTO EMP VALUES

        (7934, 'MILLER', 'CLERK',

        TO_DATE('23-01-1982', 'DD-MM-YYYY'), 1300, NULL, 10);

        

        

CREATE TABLE DEPT

       (DEPTNO NUMBER(2) NOT NULL PRIMARY KEY,

        DNAME VARCHAR2(14),

        LOC VARCHAR2(13) );


INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');

INSERT INTO DEPT VALUES (20, 'RESEARCH',   'DALLAS');

INSERT INTO DEPT VALUES (30, 'SALES',      'CHICAGO');

INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');


SELECT * FROM EMP;

SELECT * FROM DEPT;

'Dev. > Back-end' 카테고리의 다른 글

SQL Table space 생성 (OEMC에서)  (12) 2012.10.04
20120925 Oracle  (2) 2012.09.25
/*Over(partition by)*/ /*inner query*/  (12) 2012.09.24
120911 오라클  (2) 2012.09.11
20120831 Oracle  (2) 2012.09.02

댓글