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
);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM