-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_db.txt
37 lines (34 loc) · 2.32 KB
/
create_db.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
DROP TABLE IF EXISTS Department;
CREATE TABLE Department (
deptno int PRIMARY KEY,
dname varchar(100),
loc varchar(100)
);
DROP TABLE IF EXISTS Employee;
CREATE TABLE Employee (
empno int NOT NULL PRIMARY KEY,
ename varchar(100),
job varchar(100),
mgr int,
hiredate date,
sal decimal(8,2),
comm decimal(8,2),
deptno int NOT NULL REFERENCES Department(deptno)
);
INSERT INTO Department (deptno,dname,loc) VALUES (10,'Accounting','New-York');
INSERT INTO Department (deptno,dname,loc) VALUES (20,'Research','Dallas');
INSERT INTO Department (deptno,dname,loc) VALUES (30,'Sales','Chicago');
INSERT INTO Department (deptno,dname,loc) VALUES (40,'Operations','Boston');
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7369,'Smith','Clerk',7902,'17-dec-80',800,null,20);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7499,'Allen','Salesman',7698,'20-feb-81',1600,300,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7521,'Ward','Salesman',7698,'22-feb-81',1250,500,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7566,'Jones','Manager',7839,'02-apr-81',2975,null,20);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7654,'Martin','Salesman',7698,'28-sep-81',1250,1400,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7698,'Blake','Manager',7839,'01-may-81',2850,null,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7782,'Clark','Manager',7839,'09-jun-81',2450,null,10);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7839,'King','President',null,'17-nov-81',5000,null,10);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7844,'Turner','Salesman',7698,'08-sep-81',1500,0,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7876,'Adams','Clerk',7788,'23-sep-87',1100,null,20);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7900,'James','Clerk',7698,'03-dec-81',950,null,30);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7902,'Ford','Analyst',7566,'03-dec-81',3000,null,20);
INSERT INTO Employee (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES (7934,'Miller','Clerk',7782,'23-jan-82',1300,null,10);