当前位置:Gxlcms > 数据库问题 > MySQL 表设计案例

MySQL 表设计案例

时间:2021-07-01 10:21:17 帮助过:26人阅读

创建一个库:_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
);

MySQL 表设计案例

标签:cti   3.0   data-   primary   comment   nbsp   time   key   图片   

人气教程排行