作业:订餐系统

/*
Navicat MySQL Data Transfer

Source Server : localhost_3306
Source Server Version : 50558
Source Host : localhost:3306
Source Database : 订餐数据库

Target Server Type : MYSQL
Target Server Version : 50558
File Encoding : 65001

Date: 2017-10-22 19:42:01
*/

SET FOREIGN_KEY_CHECKS=0;


– Table structure for cost-dining


DROP TABLE IF EXISTS cost-dining;
CREATE TABLE cost-dining (
id varchar(255) NOT NULL,
costomer_id varchar(255) NOT NULL,
dining_id varchar(255) NOT NULL,
KEY fk-06 (costomer_id),
KEY fk-07 (dining_id),
CONSTRAINT fk-07 FOREIGN KEY (dining_id) REFERENCES dining (id),
CONSTRAINT fk-06 FOREIGN KEY (costomer_id) REFERENCES costomer (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


– Records of cost-dining


INSERT INTO cost-dining VALUES (‘D1’, ‘A1’, ‘A4’);
INSERT INTO cost-dining VALUES (‘D2’, ‘A2’, ‘A3’);
INSERT INTO cost-dining VALUES (‘D3’, ‘A3’, ‘A2’);
INSERT INTO cost-dining VALUES (‘D4’, ‘A4’, ‘A1’);


– Table structure for costomer


DROP TABLE IF EXISTS costomer;
CREATE TABLE costomer (
id varchar(255) NOT NULL,
name varchar(255) NOT NULL,
phone varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


– Records of costomer


INSERT INTO costomer VALUES (‘A1’, ‘小明’, ‘123321’);
INSERT INTO costomer VALUES (‘A2’, ‘小何’, ‘231321’);
INSERT INTO costomer VALUES (‘A3’, ‘小聪’, ‘123123’);
INSERT INTO costomer VALUES (‘A4’, ‘小丫’, ‘232112’);


– Table structure for cost_meau


DROP TABLE IF EXISTS cost_meau;
CREATE TABLE cost_meau (
id varchar(255) NOT NULL,
cost_id varchar(255) NOT NULL,
meau_id varchar(100) NOT NULL,
price int(11) NOT NULL,
KEY fk-05 (cost_id),
KEY fk-04 (meau_id) USING BTREE,
CONSTRAINT fk-04 FOREIGN KEY (meau_id) REFERENCES meau (id),
CONSTRAINT fk-05 FOREIGN KEY (cost_id) REFERENCES costomer (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;


– Records of cost_meau


INSERT INTO cost_meau VALUES (‘F1’, ‘A1’, ‘C1’, ‘110’);
INSERT INTO cost_meau VALUES (‘F2’, ‘A1’, ‘C2’, ‘222’);
INSERT INTO cost_meau VALUES (‘F3’, ‘A1’, ‘C3’, ‘123’);
INSERT INTO cost_meau VALUES (‘F4’, ‘A2’, ‘C4’, ‘121’);
INSERT INTO cost_meau VALUES (‘F5’, ‘A2’, ‘C5’, ‘213’);
INSERT INTO cost_meau VALUES (‘F6’, ‘A2’, ‘C6’, ‘213’);
INSERT INTO cost_meau VALUES (‘F7’, ‘A3’, ‘C7’, ‘213’);
INSERT INTO cost_meau VALUES (‘F8’, ‘A3’, ‘C8’, ‘421’);
INSERT INTO cost_meau VALUES (‘F9’, ‘A3’, ‘C9’, ‘123’);
INSERT INTO cost_meau VALUES (‘F10’, ‘A4’, ‘C10’, ‘124’);
INSERT INTO cost_meau VALUES (‘F11’, ‘A4’, ‘C11’, ‘123’);
INSERT INTO cost_meau VALUES (‘F12’, ‘A4’, ‘C12’, ‘100’);


– Table structure for dining


DROP TABLE IF EXISTS dining;
CREATE TABLE dining (
id varchar(255) NOT NULL,
name varchar(255) NOT NULL,
place varchar(255) NOT NULL,
KEY fk-01 (id),
CONSTRAINT fk-01 FOREIGN KEY (id) REFERENCES costomer (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


– Records of dining


INSERT INTO dining VALUES (‘A1’, ‘小聪餐厅’, ‘崇川区’);
INSERT INTO dining VALUES (‘A2’, ‘小华餐厅’, ‘开发区’);
INSERT INTO dining VALUES (‘A3’, ‘小明餐厅’, ‘港闸区’);
INSERT INTO dining VALUES (‘A4’, ‘小永餐厅’, ‘通州区’);


– Table structure for list


DROP TABLE IF EXISTS list;
CREATE TABLE list (
id int(11) NOT NULL,
ac varchar(255) NOT NULL,
ab varchar(255) NOT NULL,
time datetime NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


– Records of list


INSERT INTO list VALUES (‘1’, ‘D1’, ‘F1’, ‘2017-10-22 18:52:04’);
INSERT INTO list VALUES (‘2’, ‘D1’, ‘F2’, ‘2017-10-22 18:52:26’);
INSERT INTO list VALUES (‘3’, ‘D1’, ‘F3’, ‘2017-10-22 18:52:35’);
INSERT INTO list VALUES (‘4’, ‘D2’, ‘F4’, ‘2017-10-20 18:52:48’);
INSERT INTO list VALUES (‘5’, ‘D2’, ‘F5’, ‘2017-10-20 18:53:02’);
INSERT INTO list VALUES (‘6’, ‘D2’, ‘F6’, ‘2017-10-20 18:53:14’);
INSERT INTO list VALUES (‘7’, ‘D3’, ‘F7’, ‘2017-10-21 18:53:29’);
INSERT INTO list VALUES (‘8’, ‘D3’, ‘F8’, ‘2017-10-21 18:53:42’);
INSERT INTO list VALUES (‘9’, ‘D3’, ‘F9’, ‘2017-10-21 18:54:04’);
INSERT INTO list VALUES (‘10’, ‘D4’, ‘F10’, ‘2017-10-23 18:54:19’);
INSERT INTO list VALUES (‘11’, ‘D4’, ‘F11’, ‘2017-10-30 18:54:31’);
INSERT INTO list VALUES (‘12’, ‘D4’, ‘F12’, ‘2017-10-30 18:54:45’);


– Table structure for meau


DROP TABLE IF EXISTS meau;
CREATE TABLE meau (
id varchar(100) NOT NULL,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


– Records of meau


INSERT INTO meau VALUES (‘C1’, ‘红烧土豆’);
INSERT INTO meau VALUES (‘C10’, ‘韭菜炒蛋’);
INSERT INTO meau VALUES (‘C11’, ‘红烧排骨’);
INSERT INTO meau VALUES (‘C12’, ‘凤爪’);
INSERT INTO meau VALUES (‘C2’, ‘红烧鱼’);
INSERT INTO meau VALUES (‘C3’, ‘红烧肉’);
INSERT INTO meau VALUES (‘C4’, ‘红烧猪蹄’);
INSERT INTO meau VALUES (‘C5’, ‘红烧鸡’);
INSERT INTO meau VALUES (‘C6’, ‘红烧猪肉’);
INSERT INTO meau VALUES (‘C7’, ‘清蒸鱼’);
INSERT INTO meau VALUES (‘C8’, ‘清蒸鸽子’);
INSERT INTO meau VALUES (‘C9’, ‘番茄炒蛋’);

你可能感兴趣的:(作业专栏)