Table creation statement under the name of Oracle Scott
We often use data for testing when learning Oracle, so it is necessary to create tables and data.
Create table EMP
(
Empno number (4) primary key,
ENAME VARCHAR2 (10 ),
JOB VARCHAR2 (9 ),
Mgr number (4 ),
Hiredate date,
Sal number (7,2 ),
Comm number (7, 2 ),
Depno number (4)
);
Create table Depth (
Deptno number (4 ),
DNAME VARCHAR2 (14 ),
LOC VARCHAR2 (13)
);
Create table Salgrade
(
Grade number,
Losal number,
HISAL NUMBER
);
Create table Bonus
(
Ename varchar (10 ),
JOB VARCHAR2 (9 ),
Sal number,
COMM NUMBER
);
Insert into Depth VALUES (10, 'accounting', 'New YORK ');
Insert into Depth VALUES (20, 'Research ', 'Dallas ');
Insert into Depth VALUES (30, 'sales', 'Chicago ');
Insert into Depth VALUES (40, 'operations', 'boston ');
SELECT * from depth;
INSERT INTO EMP VALUES
(7369, 'Smith ', 'cler', 7902, to_date ('17-12-1980', 'dd-mm-yyyy'), 800, null, 20 );
INSERT INTO EMP VALUES
(7499, 'allen ', 'salesman', 7698, to_date ('20-2-1981 ', 'dd-mm-yyyy'), 1600,300, 30 );
INSERT INTO EMP VALUES
(7521, 'ward ', 'salesman', 7698, to_date ('22-2-1981 ', 'dd-mm-yyyy'), 1250,500, 30 );
INSERT INTO EMP VALUES
(7566, 'Jones ', 'manager', 7839, to_date ('2-4-1981', 'dd-mm-yyyy '), 2975, NULL, 20 );
INSERT INTO EMP VALUES
(7654, 'martin ', 'salesman', 7698, to_date ('28-9-1981 ', 'dd-mm-yyyy'), 30 );
INSERT INTO EMP VALUES
(7698, 'bucke', 'manager', 7839, to_date ('1-5-1981 ', 'dd-mm-yyyy'), 2850, NULL, 30 );
INSERT INTO EMP VALUES
(7782, 'clark', 'manager', 7839, to_date ('9-6-1981 ', 'dd-mm-yyyy'), 2450, NULL, 10 );
INSERT INTO EMP VALUES
(7839, 'King', 'President ', NULL, to_date ('17-11-1981', 'dd-mm-yyyy '), 5000, NULL, 10 );
INSERT INTO EMP VALUES
(7844, 'turner ', 'salesman', 7698, to_date ('8-9-1981 ', 'dd-mm-yyyy'), 0, 30 );
INSERT INTO EMP VALUES
(7900, 'James ', 'cler', 7698, to_date ('3-12-1981', 'dd-mm-yyyy '), 950, NULL, 30 );
INSERT INTO EMP VALUES
(7902, 'Ford ', 'analyst', 7566, to_date ('3-12-1981', 'dd-mm-yyyy '), 3000, NULL, 20 );
INSERT INTO EMP VALUES
(7934, 'miller ', 'cler', 7782, to_date ('23-1-1982', 'dd-mm-yyyy '), 1300, NULL, 10 );
Select * from emp
Insert into salgrade values (1,700,120 0 );
Insert into salgrade values (1400 );
Insert into salgrade values (2000 );
Insert into salgrade values (4,2001, 3000 );
Insert into salgrade values (5, 3001, 9999 );
Select * from salgrade