-- Copyright (c) Oracle Corporation 1988, 1993.  All Rights Reserved.

DROP TABLE IF EXISTS Emp;
DROP TABLE IF EXISTS Dept;
DROP TABLE IF EXISTS Bonus;
DROP TABLE IF EXISTS Salgrade;
DROP TABLE IF EXISTS Dummy;

CREATE TABLE Dept
  (deptno NUMERIC(2) PRIMARY KEY,
   dname VARCHAR(14),
   loc VARCHAR(13));

INSERT INTO Dept VALUES
                 (10,'Accounting','New York'),
                 (20,'Research','Dallas'),
                 (30,'Sales','Chicago'),
                 (40,'Operations','Boston');

CREATE TABLE Emp
  (empno NUMERIC(4) PRIMARY KEY,
   ename VARCHAR(10),
   job VARCHAR(9),
   mgr NUMERIC(4),
   hiredate DATE,
   sal NUMERIC(7,2),
   comm NUMERIC(7,2),
   deptno NUMERIC(2) REFERENCES Dept);

INSERT INTO Emp VALUES
        (7369,'Smith','CLERK',7902,'17-DEC-80',800,NULL,20);
INSERT INTO Emp VALUES
        (7499,'Allen','SALESMAN',7698,'20-FEB-81',1600,300,30),
        (7521,'Ward','SALESMAN',7698,'22-FEB-81',1250,500,30),
        (7566,'Jones','MANAGER',7839,'2-APR-81',2975,NULL,20),
        (7654,'Martin','SALESMAN',7698,'28-SEP-81',1250,1400,30),
        (7698,'Blake','MANAGER',7839,'1-MAY-81',2850,NULL,30),
        (7782,'Clark','MANAGER',7839,'9-JUN-81',2450,NULL,10),
        (7788,'Scott','ANALYST',7566,'09-DEC-82',3000,NULL,20),
        (7839,'King','PRESIDENT',NULL,'17-NOV-81',5000,NULL,10),
        (7844,'Turner','SALESMAN',7698,'8-SEP-81',1500,0,30),
        (7876,'Adams','CLERK',7788,'12-JAN-83',1100,NULL,20),
        (7900,'James','CLERK',7698,'3-DEC-81',950,NULL,30),
        (7902,'Ford','ANALYST',7566,'3-DEC-81',3000,NULL,20),
        (7934,'Miller','CLERK',7782,'23-JAN-82',1300,NULL,10);

CREATE TABLE Bonus
       (ename VARCHAR(10),
        job VARCHAR(9),
        sal NUMERIC,
        comm NUMERIC);

CREATE TABLE Salgrade
       (grade NUMERIC,
        losal NUMERIC,
        hisal NUMERIC);

INSERT INTO Salgrade VALUES (1,700,1200);
INSERT INTO Salgrade VALUES (2,1201,1400);
INSERT INTO Salgrade VALUES (3,1401,2000);
INSERT INTO Salgrade VALUES (4,2001,3000);
INSERT INTO Salgrade VALUES (5,3001,9999);

CREATE TABLE Dummy
       (dummy NUMERIC);

INSERT INTO Dummy VALUES (0);

