数据库的题目,用mysql做,怎么做这道题,有大神解答吗?

 

-- 1、创建数据库

create database company_info;

-- 打开数据库

use company_info;

 

-- 创建 Employee

create table Employee(

EmployeeID int primary key auto_increment,

EmployeeName char(8) not null,

EmployeeSex char(2) not null default '女',

Emplthday datetime ,

HiringTime datetime not null,

Specialty varchar(50),

Salary double

)

 

-- 创建Category

create table Category(

TypeID int primary key,

TypeNmae char(30) not null,

TypeNote char(50)

)

 

-- 创建 Product

create table Product(

ProductID int primary key,

Productname char(10) not null,

TypeID int,

foreign key(TypeID) references Category(TypeID),

UnitPrice double not null,

Inventory int not null

)

 

-- 创建 Customer

create table Customer(

CustomerID int primary key,

CompanyName char(30) not null,

ContactName char(8) not null,

Contactipone char(13),

address char(30),

Cod char(6)

 

)

 

 

-- 创建 P_order

create table P_order (

OrderID int primary key,

ProductID int,

foreign key(ProductID) references Product(ProductID),

number int not null,

EmployeeID int,

foreign key(EmployeeID) references Employee(EmployeeID),

CustomerID int,

foreign key(CustomerID) references Customer(CustomerID),

OrderTime datetime not null

)