微信点餐系统之数据库的设计

订单详情表

  • 订单id
  • 商品id
  • 商品名字
  • 商品价格
  • 商品数量
  • 商品图片:这里的商品的小图片用 的是连接,所以我们用varchar(512)
 create table order_detail(
	order_id varchar(32) primary key,
	product_id varchar(32) not null,
	product_price decimal(8,2) not null,
	product_qulity int not null,
	product_icon varchar(512) not null,
	create_time timestamp not null default current_timestamp comment'创建时间' ,
	update_time timestamp not null default current_time on update current_timestamp  commit '修改时间'
);

商品表

  • 编号 :用int 类型也可以,但是int 类型有上限,这是企业级的项目,所以用int 不合适,我们用varchar类型。
  • 名称:varcar(64)
  • 单价:涉及到金钱的我们用decimal(a,b);
  • 库存
  • 描述
create table product_info(
	product_id varchar(32) primary key,
	product_name varchar(64) not null,
	product_price decimal(8,2) not null,
	product_qulicatlity int not null,
	product_description varchar(512) not null,
	create_time timestamp not null default current_timestamp comment'创建时间' ,
	update_time timestamp not null default current_time on update current_timestamp  commit '修改时间'
) '商品表';

商品种类表

  • 种类的id
  • 种类的名称
  • 种类的类型
  • 创建时间
  • 修改时间
create table product_category(
	category_id varchar(32) primary key,
	category_name varchar(64) nut null,
	category_type int not null,
	create_time timestamp not null default current_time comment '创建时间',
	update_time timestamp not null default current_time
	on update current_time commit '修改时间' 
)comment'商品种类表';

订单主表

  • 订单id
  • 卖家姓名
  • 买家手机号
  • 买家地址
  • 买家的微信号
  • 购买商品的数量
  • 订单的状态
  • 订单的支付状态
create table order_master(
	order_id varchar(32) primary key,
	buyer_name varchar(64) not null,
	buyer_phone varchar(32) not null,
	buyer_address varchar(64) not null,
	order_amount decimal(8,2) not null,
	order_status tinyint default 0 comment'订单的状态默认为已提交',
	pay_status tinyint default 0 comment '支付状态默认为未支付',
	create_time timestamp not null default current_time comment '创建时间',
	update_time timestamp not null default current_time
	on update current_time commit '修改时间' 
	)comment'订单主表';
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值