Create four tables for Oracle Scott users and insert initialization data in MySQL

Source: Internet
Author: User
Tags dname

The meaning of the fields of each table:

(Reference from: http://www.cnblogs.com/mchina/archive/2012/09/06/2649951.html)


1, Department table: Dept

name

type

Description

1

DEPTNO

Number (2)

Represents the department number, consisting of two digits

2

Dname

VARCHAR2 (14)

Department name, up to a maximum of 14 characters

3

LOC

VARCHAR2 (13)

Where the department is located

2. Employee table: EMP

name

type

Description

1

EMPNO

Number (4)

Number of employees, consisting of four digits

2

Ename

VARCHAR2 (10)

The name of the employee, consisting of a 10-character

3

JOB

VARCHAR2 (9)

Position of employee

4

MGR

Number (4)

Employee corresponding leader number, the leader is also an employee

5

HireDate

DATE

Employee's employment date

6

SAL

Number (7,2)

Base pay, which has two decimal places, five times times integers, altogether seven bits

7

COMM

Number (7,2)

Bonuses, commissions

8

DEPTNO

Number (2)

Department number where the employee is located

3. Salary scale: Salgrade

name

type

Description

1

GRADE

Number

Level of wages

2

Losal

Number

Minimum wage at this level

3

Hisal

Number

Maximum wage at this level

4. Salary Table: Bonus

name

type

Description

1

Ename

VARCHAR2 (10)

Employee Name

2

JOB

VARCHAR2 (9)

Employee positions

3

SAL

Number

Wages of employees

4

COMM

Number

Bonuses for employees


Two. Create statements for each table:

(Reference from: http://blog.csdn.net/qptufly/article/details/7881017)

Create_dept.sql


/* Create a Dept table in the Scott database when: Thursday, December 18, 2014 19:45:10 CST Small Code */CREATE TABLE Dept (--Department number deptno int unsigned a  Uto_increment primary KEY,--department name Dname varchar (15),--Department location LOC varchar () engine = InnoDB;


Create_emp.sql



/* Function: Create an EMP table in the Scott database time: December 18, 2014 Thu 19:51:32 CST Small code */CREATE TABLE EMP (    --employee number    empno           int unsigned Auto_increment primary KEY,    --employee name    ename           varchar     ,    --employee job title             varchar ($)     , --    employee corresponding leader's number    Mgr             int unsigned,--    employee's employment date    hiredate Date            ,    -- Employee's base salary    sal             decimal (7,2)    ,--    bonus    comm            Decimal (7,2)    ,--    Department    Deptno          int unsigned    ,    foreign Key (DEPTNO) References Dept (DEPTNO)) engine = InnoDB;


Create_salgrade.sql



/* Function: Create database Salgrade table in Scott, salary scale table time: Thursday, December 18, 2014 19:58:09 CST Small Code */CREATE TABLE Salgrade (    --Salary level    grade
   int unsigned    ,    --The minimum wage for this level    losal       int unsigned    ,    -the highest wage for this level    hisal       int unsigned    ) Engine=innodb;


Create_bonus.sql



/* Function: Create database Scott's bonus table, payroll time: Thursday, December 18, 2014 20:03:52 CST Small Code */CREATE TABLE bonus (    --employee name    ename       var char ($),    --employee job    job         varchar (9),--    Employee Payroll    sal         Decimal (7,2),    --employee funds    Comm        decimal (7,2)) Engine=innodb;


Insert_dept.sql



/* Function: Insert database initialization data for table dept in Scott Time: December 18, 2014 Thu 20:14:34 CST Small Code */insert into dept VALUES (' ACCOUNTING ', ' NEW YORK ') INSERT INTO Dept values ("DALLAS"), insert into dept values ("SALES", ' CHICAGO '), insert into dept values ( , ' OPERATIONS ', ' BOSTON ');


Insert_emp.sql



/* Function: Insert database initial data for table EMP in Scott time: December 18, 2014 Thu 20:15:23 CST Small code */insert into EMP VALUES (7369, ' SMITH ', ' clerk ', 7902, ' 1980-12-17 ', 800,null,20); INSERT into EMP VALUES (7499, ' ALLEN ', ' salesman ', 7698, ' 1981-2-20 ', 1600,300,30); EMP VALUES (7521, ' WARD ', ' salesman ', 7698, ' 1981-2-22 ', 1250,500,30); INSERT into EMP values (7566, ' JONES ', ' MANAGER ', 7839 , ' 1981-4-2 ', 2975,null,20); INSERT into EMP VALUES (7654, ' MARTIN ', ' salesman ', 7698, ' 1981-9-28 ', 1250,1400,30); insert into EMP values (7698, ' BLAKE ', ' manager ', 7839, ' 1981-5-1 ', 2850,null,30); INSERT into EMP values (7782, ' CLARK ', ' manager ' , 7839, ' 1981-6-9 ', 2450,null,10); INSERT into EMP VALUES (7788, ' SCOTT ', ' ANALYST ', 7566, ' 87-7-13 ', 3000,null,20); insert into EMP values (7839, ' KING ', ' president ', NULL, ' 1981-11-17 ', 5000,null,10); INSERT into EMP values (7844, ' TURNER ', ' SALE Sman ', 7698, ' 1981-9-8 ', 1500,0,30); INSERT into EMP VALUES (7876, ' ADAMS ', ' clerk ', 7788, ' 87-7-13 ', 1100,null,20); insert into EMP VALUES (7900, ' JAMES ', ' clerk ', 7698, ' 1981-12-3 ', 950,null,30); INSERT into EMP VALUES (7902, ' FORD ', ' ANALYST ', 7566, ' 1981-12-3 ', 3000,null,20); EMP VALUES (7934, ' MILLER ', ' clerk ', 7782, ' 1982-1-23 ', 1300,null,10);


Insert_salgrade.sql



/* Function: Insert database The initial data time for table Salgrade in Scott: Thursday, December 18, 2014 20:16:09 CST Small code */insert into Salgrade VALUES (1,700,1200); INSERT I NTO Salgrade VALUES (2,1201,1400), insert into Salgrade values (3,1401,2000), insert into Salgrade values (4,2001,3000); INS ERT into Salgrade VALUES (5,3001,9999);




Create four tables for Oracle Scott users and insert initialization data in MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.