新建数据库mydb6_product,新建3张表如下:employess表,orders表和invoices表
一:创建employess表
mysql> create database mydb6_product;
mysql> use mydb6_product;
mysql> create table employess(id int,name char(50),age int,gender char(10),salary float);
mysql> desc employess;
mysql> alter table employess modify id int not null;
mysql> alter table employess modify name char(50) not null;
mysql> alter table employess modify gender char(10) not null;
二:创建orders表
mysql>create table orders(id int not null,name varchar(100) not null,price float,category varchar(50));
mysql> alter table employess add primary key(id);
三:创建invoices表
create table invoices(number int not null primary key auto_increment,order_id int,foreign key (order_id) references invoices(number),in_date date,total_amouunt float);