建立mydb6_product库
mysql> create database mydb6_product;
mysql> use mydb6_product;
建立employees表
create table employees(
-> id int primary key,
-> name varchar(50) not null,
-> age int,
-> gender char(10) not null default 'unknown',
-> salary float);
表的框架
建立 orders表
mysql> create table orders(
-> id int primary key,
-> name varchar(100) not null,
-> price float,
-> quantity int,
-> category varchar(50)
-> );
表的框架
建立invoices表
mysql> create table invoices(
-> number int auto_increment primary key,
-> order_id int not null ,
-> in_date date,
-> total_amount float check (total_amount >0),
-> foreign key (order_id) references orders(id)
-> );
表的框架