码迷,mamicode.com
首页 > 数据库 > 详细

企业点餐系统数据库脚本

时间:2018-07-26 18:23:40      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:round   创建时间   char   amp   status   pen   地址   脚本   comm   

---恢复内容开始---

2018-07-26

CREATE TABLE product_info (
product_id VARCHAR ( 32 ) NOT NULL,
product_name VARCHAR ( 64 ) NOT NULL COMMENT ‘商品名称‘,
product_price DECIMAL ( 8, 2 ) NOT NULL COMMENT ‘单价‘,
product_stock INT NOT NULL COMMENT ‘库存‘,
product_description VARCHAR ( 64 ) COMMENT ‘描述‘,
product_icon VARCHAR ( 512 ) COMMENT ‘小图‘,
category_type INT NOT NULL COMMENT ‘类目编号‘,
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘修改时间‘,
PRIMARY KEY ( product_id )
) COMMENT = ‘商品表‘;
CREATE TABLE product_category (
category_id INT NOT NULL auto_increment,
category_name VARCHAR ( 64 ) NOT NULL COMMENT ‘商品名称‘,
category_type INT NOT NULL COMMENT ‘类目编号‘,
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘修改时间‘,
PRIMARY KEY ( category_id ),
UNIQUE KEY uqe_category_type ( category_type )
) COMMENT = ‘类目表‘;
CREATE TABLE order_master (
order_id VARCHAR ( 32 ) NOT NULL,
buyer_name VARCHAR ( 32 ) NOT NULL COMMENT ‘买家名字‘,
buyer_phone VARCHAR ( 32 ) COMMENT ‘买家电话‘,
buyer_address VARCHAR ( 128 ) COMMENT ‘买家地址‘,
buyer_openid VARCHAR ( 128 ) COMMENT ‘买家地址‘,
order_amount DECIMAL ( 8, 2 ) NOT NULL COMMENT ‘订单总金额‘,
pay_status TINYINT ( 3 ) NOT NULL DEFAULT 0 COMMENT ‘订单状态,默认0新下单‘,
order_status TINYINT ( 3 ) NOT NULL DEFAULT 0 COMMENT ‘订单状态,默认0未支付‘,
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘修改时间‘,
PRIMARY KEY ( order_id ),
KEY idx_buyer_openid ( buyer_openid )
) COMMENT = ‘订单表‘;
CREATE TABLE order_detai (
detail_id VARCHAR ( 32 ) NOT NULL,
order_id VARCHAR ( 32 ),
product_name VARCHAR ( 64 ) NOT NULL COMMENT ‘商品名称‘,
product_price DECIMAL ( 8, 2 ) NOT NULL COMMENT ‘商品价格‘,
product_quantity INT NOT NULL COMMENT ‘商品数量‘,
product_icon VARCHAR ( 512 ) COMMENT ‘商品小图‘,
category_type INT NOT NULL COMMENT ‘类目编号‘,
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘修改时间‘,
PRIMARY KEY ( detail_id ),
KEY idx_order_id ( order_id )
) COMMENT = ‘订单详情表‘;

---恢复内容结束---

企业点餐系统数据库脚本

标签:round   创建时间   char   amp   status   pen   地址   脚本   comm   

原文地址:https://www.cnblogs.com/sjpv/p/9372716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!