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