MySQL 表设计案例

创建一个库:_shop

 

创建三个表(对应的图有对应字段名):

 

菜单:menu

 
 
菜单分类:menu_type
 
 
 
订单:order
 
 
建表语句:

 create table menu(
menu_id int unsigned  auto_increment,
menu_name varchar(100) not null,
menu_price decimal(10,2) default 0,
menu_stutas tinyint default 1 comment"defult 1, 1:在线 2:删除3:售空  ",
type_id int unsigned,
img varchar(255),
ctime timestamp,
primary key (menu_id)
);


create table menu_type(
type_id int unsigned primary key auto_increment,
type_name varchar(50) not null
);

create table corder(
order_id int unsigned primary key auto_increment,
menu_id int unsigned ,
num smallint unsigned  comment"defult 1, 1:1份",
totle_price decimal(14,2) not null,
ctime timestamp,
order_stutas tinyint default 1 comment"defult 1, 1:下单 2:取消 ",
pay_stutas tinyint default 1 comment"defult 1, 1:支付成功 2:支付失败 ",
mark text
);

猜你喜欢

转载自www.cnblogs.com/lotus-wmm/p/10851187.html