曹操外卖数据表设计

/*
Navicat Premium Data Transfer

Source Server : localhost_3306
Source Server Type : MySQL
Source Server Version : 50725
Source Host : localhost:3306
Source Schema : caocao

Target Server Type : MySQL
Target Server Version : 50725
File Encoding : 65001

Date: 27/09/2019 11:27:56
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`CateID` int(10) NOT NULL AUTO_INCREMENT,
`CateName` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`CateID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES (1, '快餐');
INSERT INTO `category` VALUES (2, '饺子混沌');
INSERT INTO `category` VALUES (3, '汉堡薯条');
INSERT INTO `category` VALUES (4, '包子粥店');
INSERT INTO `category` VALUES (5, '川湘菜');
INSERT INTO `category` VALUES (6, '米粉面馆');
INSERT INTO `category` VALUES (7, '汤馆');
INSERT INTO `category` VALUES (8, '特色小吃');
INSERT INTO `category` VALUES (9, '烧烤');
INSERT INTO `category` VALUES (10, '大盘鸡');
INSERT INTO `category` VALUES (11, '川湘菜园');
INSERT INTO `category` VALUES (12, '张三大盘鸡');
INSERT INTO `category` VALUES (14, '餐饮店');
INSERT INTO `category` VALUES (15, '西餐厅');
INSERT INTO `category` VALUES (16, '快餐');
INSERT INTO `category` VALUES (17, '汉堡薯条');
INSERT INTO `category` VALUES (18, '饺子混沌');

-- ----------------------------
-- Table structure for customers
-- ----------------------------
DROP TABLE IF EXISTS `customers`;
CREATE TABLE `customers` (
`CustID` int(10) NOT NULL,
`CustName` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`LoginPwd` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`Email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`address` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`Accout` double(10, 0) NULL DEFAULT NULL,
`logstart` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`CustID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of customers
-- ----------------------------
INSERT INTO `customers` VALUES (21, '小黑', '965636', '1881368541', '123@123.com', '九都西路', NULL, '已登录');
INSERT INTO `customers` VALUES (22, '小红', '123123', '1351329612', '136@136.com', '南昌北路', 1000, NULL);
INSERT INTO `customers` VALUES (23, '小白', '654321', '1881358545', '132@136.com', '中州西路', NULL, NULL);
INSERT INTO `customers` VALUES (24, '小紫', '321123', '1321378154', '121@136.com', '周山北路', NULL, NULL);
INSERT INTO `customers` VALUES (25, '小蓝', '123321', '1961358592', '196@136.com', '九都东路', NULL, NULL);
INSERT INTO `customers` VALUES (26, 'Tom', 'Tom_Love$book', '010-60257566', 'tom@hotmail.com', '北京市海淀区苏州街18号维亚大厦12楼', 0, NULL);
INSERT INTO `customers` VALUES (28, 'Tom', '123456', '010-60257566', 'tom@hotmail.com', '北京市海淀区苏州街18号维亚大厦12楼', NULL, NULL);

-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`GoodsId` int(10) NOT NULL AUTO_INCREMENT,
`Title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`UnitPrice` double(10, 2) NOT NULL,
`Discount` double(10, 2) NULL DEFAULT NULL,
`CateId` int(10) NULL DEFAULT NULL,
`StoreId` int(10) NULL DEFAULT NULL,
`Roat` int(10) NULL DEFAULT NULL,
`Description` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`PackingExpense` double(10, 0) NULL DEFAULT NULL,
`likel` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`GoodsId`) USING BTREE,
INDEX `CateId`(`CateId`) USING BTREE,
INDEX `StoreId`(`StoreId`) USING BTREE,
CONSTRAINT `aaa` FOREIGN KEY (`CateId`) REFERENCES `category` (`CateID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `ssc` FOREIGN KEY (`StoreId`) REFERENCES `store` (`StoreId`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of goods
-- ----------------------------
INSERT INTO `goods` VALUES (1, '牛肉汤', 10.00, 1.00, 7, 17, 3, '变态辣', 2, '1');
INSERT INTO `goods` VALUES (2, '羊肉汤', 10.00, 0.80, 7, 17, 4, '微辣', 2, NULL);
INSERT INTO `goods` VALUES (3, '羊肉饺子', 20.00, 0.90, 2, 12, 4, '酸辣', 3, '1');
INSERT INTO `goods` VALUES (4, '八宝粥', 8.00, 1.00, 4, 14, 4, '甜', 1, NULL);
INSERT INTO `goods` VALUES (5, '川菜', 15.00, 1.00, 5, 15, 4, '酸辣', 2, NULL);
INSERT INTO `goods` VALUES (6, '大盘鸡', 25.00, NULL, NULL, 18, NULL, NULL, 2, NULL);
INSERT INTO `goods` VALUES (24, '川湘菜', 35.00, 1.00, 11, 16, 5, '微辣', 2, NULL);
INSERT INTO `goods` VALUES (25, '特色小吃', 20.00, 0.75, 8, 20, 3, '酸甜苦辣', 2, NULL);
INSERT INTO `goods` VALUES (26, '大盘鸡', 25.00, NULL, NULL, NULL, NULL, NULL, 2, NULL);
INSERT INTO `goods` VALUES (27, '大盘鸡', 25.00, NULL, NULL, NULL, NULL, NULL, 2, NULL);

-- ----------------------------
-- Table structure for orderdetails
-- ----------------------------
DROP TABLE IF EXISTS `orderdetails`;
CREATE TABLE `orderdetails` (
`OrderID` int(10) NOT NULL,
`GoodsID` int(10) NULL DEFAULT NULL,
`qty` int(10) NULL DEFAULT NULL,
`UnitPrice` double(10, 2) NULL DEFAULT NULL,
PRIMARY KEY (`OrderID`) USING BTREE,
INDEX `GoodsID`(`GoodsID`) USING BTREE,
CONSTRAINT `cc` FOREIGN KEY (`GoodsID`) REFERENCES `goods` (`GoodsId`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fff` FOREIGN KEY (`OrderID`) REFERENCES `orders` (`OrederID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of orderdetails
-- ----------------------------
INSERT INTO `orderdetails` VALUES (1001, 1, 8, 80.00);
INSERT INTO `orderdetails` VALUES (1002, 2, 4, 32.00);
INSERT INTO `orderdetails` VALUES (1003, 3, 3, 60.00);
INSERT INTO `orderdetails` VALUES (1004, 4, 6, 48.00);
INSERT INTO `orderdetails` VALUES (1005, 5, 5, 75.00);

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`OrederID` int(10) NOT NULL,
`OrderNo` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`OrderPrice` double(10, 2) NULL DEFAULT NULL,
`OrderDate` date NULL DEFAULT NULL,
`CustId` int(10) NULL DEFAULT NULL,
`CustName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`CustPhone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`CustAddress` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`ZIP` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`InvoiceTitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`InvoiceContent` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`OrderStatus` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`OrederID`) USING BTREE,
INDEX `CustId`(`CustId`) USING BTREE,
CONSTRAINT `dd` FOREIGN KEY (`CustId`) REFERENCES `customers` (`CustID`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of orders
-- ----------------------------
INSERT INTO `orders` VALUES (1001, '1010203', 10.00, '2019-09-21', 21, '小黑', '1351368541', '二七广场', '471003', NULL, '牛肉汤', '已收货');
INSERT INTO `orders` VALUES (1002, '1010204', 10.00, '2019-09-22', 22, '小红', '1351329612', '南昌北路', '471002', NULL, '羊肉汤', '已发货');
INSERT INTO `orders` VALUES (1003, '1010205', 20.00, '2019-09-22', 23, '黄雅玲', '1351358545', '中州西路', '471001', NULL, '羊肉饺子', '已付款');
INSERT INTO `orders` VALUES (1004, '1010302', 8.00, '2019-09-23', 24, '小紫', '1321378154', '二七广场', '471004', NULL, '八宝粥', '已付款');
INSERT INTO `orders` VALUES (1005, '20190220001', 15.00, '2019-09-23', 25, '小蓝', '1961358592', '九都东路', '471003', NULL, '鸡块米粉', '已付款');
INSERT INTO `orders` VALUES (1006, '20110508004', 25.00, '2019-09-24', NULL, '小强', '1231231231', '九都路与南昌路交叉口', NULL, NULL, NULL, NULL);

-- ----------------------------
-- Table structure for store
-- ----------------------------
DROP TABLE IF EXISTS `store`;
CREATE TABLE `store` (
`StoreId` int(10) NOT NULL AUTO_INCREMENT,
`StoreName` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`Address` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`PersonSpending` int(10) NULL DEFAULT NULL,
PRIMARY KEY (`StoreId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of store
-- ----------------------------
INSERT INTO `store` VALUES (11, '快餐乐园', '中州路', 15);
INSERT INTO `store` VALUES (12, '饺子混沌', '南昌路', 20);
INSERT INTO `store` VALUES (13, '汉堡薯条', '九都路', 25);
INSERT INTO `store` VALUES (14, '包子粥吧', '周山路', 10);
INSERT INTO `store` VALUES (15, '米粉面馆', '周山路', 16);
INSERT INTO `store` VALUES (16, '川湘菜', '南昌路', 43);
INSERT INTO `store` VALUES (17, '洛阳八大汤', '九都路', 10);
INSERT INTO `store` VALUES (18, '大盘鸡', '中州路', 16);
INSERT INTO `store` VALUES (19, '烧烤广场', '南昌路', 20);
INSERT INTO `store` VALUES (20, '特色小吃', '周山路', 20);

SET FOREIGN_KEY_CHECKS = 1;

posted @ 2019-10-08 10:45  暮茗荋莱  阅读(554)  评论(0编辑  收藏  举报