外卖系统

create database caocao;
use caocao
-- 外卖类别
create table category(
cateid int  PRIMARY key auto_increment,
catename varchar(10) 
);

-- 商家信息
create table store(
storeid int PRIMARY key auto_increment, ,
storename varchar(30) ,
address varchar(40) ,
personspending int
);

-- 外卖商品信息表
create table goods(
goodsid int PRIMARY key auto_increment,,
title varchar(50) not null,
unitprice DOUBLE not null,
discount DOUBLE default'1',
cateid int,
storeid int,
roat int default'0',
description varchar(200),
packingexpense double not null
);

-- 客户信息
create table customers(
custid int PRIMARY key ,
custname varchar(30) not null,
loginpwd varchar(64) not null,
phone varchar(20) not null,
email varchar(50) not null,
address varchar(80),
account double not null default'0'
);

-- 订单表
create table orders(
orderid int(20) Auto_INCREMENT PRIMARY key,
orderno varchar(20) not null unique,
orderprice double,
orderdate date,
custid int,
 CONSTRAINT caocao_customers_custid FOREIGN KEY(custid) REFERENCES customers(custid),
custname varchar(20),
custphone varchar(20) not null,
custaddress varchar(40) not null,
zip varchar(4) not null,
invoicetitle varchar(50),
invoicecontent varchar(20), 
orderstatus varchar(50) default'未付款'
);



insert into category values(CateID,'快餐');
insert into category values(CateID,'饺子');
insert into category values(CateID,'汉堡');
insert into category values(CateID,'薯条');
insert into category values(CateID,'包子');
insert into category values(CateID,'粥');


insert into store values(storeId,'快餐店','河南许昌',35);
insert into store values(storeId,'小红餐馆','河南许昌',30);
insert into store values(storeId,'小兰面馆','河南郑州',30);
insert into store values(storeId,'张三麻辣烫','河南郑州',50);
insert into store values(storeId,'李四炸鸡','河南周口',50);
insert into store values(storeId,'王佳火锅店','河南周口',60);



©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 表情是什么,我认为表情就是表现出来的情绪。表情可以传达很多信息。高兴了当然就笑了,难过就哭了。两者是相互影响密不可...
    Persistenc_6aea阅读 126,388评论 2 7
  • 16宿命:用概率思维提高你的胜算 以前的我是风险厌恶者,不喜欢去冒险,但是人生放弃了冒险,也就放弃了无数的可能。 ...
    yichen大刀阅读 6,131评论 0 4