Example of creating table statements for user Scott in MySQL version of Oracle

Example of creating table statements for user Scott in MySQL version of Oracle

Overview:

Oracle scott user has four tables, which are more convenient for experiments and data verification. Now it is modified to MySQL version

1. Department table--dept

2. Employee table--emp

3. Salary Grade Table--salgrade

4. Bonus table--bonus

dept

--Create table
create table DEPT
(
 deptno INT(2) not null,
 dname VARCHAR(14),
 loc VARCHAR(13)
) engine=InnoDB charset=utf8; 
-- Create/Recreate primary, unique and foreign key constraints 
alter table DEPT
 add constraint PK_DEPT primary key (DEPTNO)
;
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');

emp

--Create table
create table EMP
(
 empno INT(4) not null,
 ename VARCHAR(10),
 job VARCHAR(9),
 mgr INT(4),
 hiredate DATE,
 sal decimal(7,2),
 comm decimal(7,2),
 deptno INT(2)
) engine=InnoDB charset=utf8;
-- Create/Recreate primary, unique and foreign key constraints 
alter table EMP
 add constraint PK_EMP primary key (EMPNO);
alter table EMP
 add constraint FK_DEPTNO foreign key (DEPTNO)
 references DEPT (DEPTNO);
insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7369', 'SMITH', 'CLERK', '7902','1980-12-17', '800', null, '20');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7499', 'ALLEN', 'SALESMAN', '7698', '1981-02-20', '1600', '300', '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7521', 'WARD', 'SALESMAN', '7698', '1981-02-22', '1250', '500', '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7566', 'JONES', 'MANAGER', '7839', '1981-04-02', '2975', null, '20');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7654', 'MARTIN', 'SALESMAN', '7698', '1981-09-28', '1250', '1400', '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7698', 'BLAKE', 'MANAGER', '7839', '1981-05-01', '2850', null, '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7782', 'CLARK', 'MANAGER', '7839', '1981-06-09', '2450', null, '10');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7788', 'SCOTT', 'ANALYST', '7566', '1987-06-13', '3000', null, '20');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7839', 'KING', 'PRESIDENT', null, '1981-11-17', '5000', null, '10');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7844', 'TURNER', 'SALESMAN', '7698', '1981-09-08', '1500', '0', '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7876', 'ADAMS', 'CLERK', '7788', '1987-06-13', '1100', null, '20');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7900', 'JAMES', 'CLERK', '7698', '1981-12-03', '950', null, '30');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7902', 'FORD', 'ANALYST', '7566', '1981-12-03', '3000', null, '20');

insert into EMP(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values ​​('7934', 'MILLER', 'CLERK', '7782', '1982-01-23', '1300', null, '10');

salgrade

create table SALGRADE
(
 grade INT,
 losal INT,
 hisal INT
) engine=InnoDB charset=utf8;
insert into SALGRADE(GRADE, LOSAL, HISAL)
values ​​('1', '700', '1200');

insert into SALGRADE(GRADE, LOSAL, HISAL)
values ​​('2', '1201', '1400');

insert into SALGRADE(GRADE, LOSAL, HISAL)
values ​​('3', '1401', '2000');

insert into SALGRADE(GRADE, LOSAL, HISAL)
values ​​('4', '2001', '3000');

insert into SALGRADE(GRADE, LOSAL, HISAL)
values ​​('5', '3001', '9999');

bonus

create table BONUS
(
 ename VARCHAR(10),
 job VARCHAR(9),
 sal INT,
 comm INT
) engine=InnoDB charset=utf8 ;

Summarize

This is the end of this article about the table creation statement of the Scott user under the MySQL version of Oracle. For more relevant content about the table creation statement of the Scott user under the MySQL version of Oracle, please search the previous articles of 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Scott Data Mapping MySQL Code Implementation Sharing

<<:  Use pure CSS to create a pulsating loader effect source code

>>:  Summary of JS tips for creating or filling arrays of arbitrary length

Recommend

Detailed explanation of the solution to Tomcat's 404 error

The 404 problem occurs in the Tomcat test. The pr...

Detailed explanation of the principle and function of Vue list rendering key

Table of contents The principle and function of l...

Explanation of the concept and usage of Like in MySQL

Like means "like" in Chinese, but when ...

MySQL 8.0.17 installation and configuration method graphic tutorial

This article shares the installation and configur...

JavaScript Canvas draws dynamic wireframe effect

This article shares the specific code of JavaScri...

One line of code solves various IE compatibility issues (IE6-IE10)

x-ua-compatible is used to specify the model for ...

Tutorial on configuring and using i3 window manager in Linux

In this article, I will show you how to install a...

Quickly solve the problem of slow startup after Tomcat reconfiguration

During the configuration of Jenkins+Tomcat server...

Detailed explanation of Jquery datagrid query

Table of contents Add code to the Tree item; 1. S...

Detailed explanation of data type issues in JS array index detection

When I was writing a WeChat applet project, there...

Introduction to RHCE bridging, password-free login and port number modification

Table of contents 1. Configure bridging and captu...

How to change the MySQL database file directory in Ubuntu

Preface The company's Ubuntu server places th...