Verified Commit cf382c9a authored by Kiryuu Sakuya's avatar Kiryuu Sakuya 🎵
Browse files

Add an example database from teacher

parent efbf55fa
/*
Navicat MySQL Data Transfer
Source Server : 11
Source Server Version : 50041
Source Host : localhost:3306
Source Database : wuliugongsi
Target Server Type : MYSQL
Target Server Version : 50041
File Encoding : 65001
Date: 2018-01-02 19:56:30
*/
SET FOREIGN_KEY_CHECKS=0;
-- CREATE DATABASE logistics DEFAULT CHARSET utf8;
-- ----------------------------
-- Table structure for `c`
-- ----------------------------
DROP TABLE IF EXISTS `C`;
CREATE TABLE `C` (
`Cno` varchar(10) NOT NULL,
`Cname` varchar(8) default NULL,
`Cage` int(8) default NULL,
`Csalary` int(10) default NULL,
PRIMARY KEY (`Cno`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of c
-- ----------------------------
INSERT INTO `C` VALUES ('1', '李余', '20', '2700');
INSERT INTO `C` VALUES ('3', '吴兵', '45', '3400');
INSERT INTO `C` VALUES ('4', '孟哲', '35', '2800');
INSERT INTO `C` VALUES ('5', '吴兵', '45', '3400');
INSERT INTO `C` VALUES ('2', '刘航', '26', '3700');
-- ----------------------------
-- Table structure for `d`
-- ----------------------------
DROP TABLE IF EXISTS `D`;
CREATE TABLE `D` (
`Cno` varchar(9) NOT NULL default '',
`Pno` varchar(10) NOT NULL default '',
`Dtime` varchar(20) default NULL,
PRIMARY KEY (`Cno`,`Pno`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of d
-- ----------------------------
INSERT INTO `D` VALUES ('1', '101', '2017-4-1');
INSERT INTO `D` VALUES ('2', '102', '2017-5-1');
INSERT INTO `D` VALUES ('3', '103', '2017-4-16');
INSERT INTO `D` VALUES ('4', '105', '2018-1-1');
INSERT INTO `D` VALUES ('3', '104', '2017-4-20');
INSERT INTO `D` VALUES ('5', '106', '2018-1-2');
-- ----------------------------
-- Table structure for `p`
-- ----------------------------
DROP TABLE IF EXISTS `P`;
CREATE TABLE `P` (
`Pno` varchar(15) NOT NULL,
`Pfrom` varchar(15) NOT NULL,
`Pto` varchar(10) NOT NULL,
`Preceiver` varchar(10) NOT NULL,
`Ptel` varchar(20) NOT NULL,
`Pstatus` varchar(10) NOT NULL,
PRIMARY KEY (`Pno`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of p
-- ----------------------------
INSERT INTO `P` VALUES ('101', '浙江', '上海', '李四', '18779931582', '派件中');
INSERT INTO `P` VALUES ('102', '浙江', '安徽', '李云龙', '15779962563', '派件中');
INSERT INTO `P` VALUES ('103', '上海', '景德镇', '胡天', '15786592584', '派件中');
INSERT INTO `P` VALUES ('104', '上海', '景德镇', '吴易', '12545611478', '派件中');
INSERT INTO `P` VALUES ('105', '安徽', '景德镇', '吴辉', '15822115520', '派件中');
-- ----------------------------
-- Table structure for `s`
-- ----------------------------
DROP TABLE IF EXISTS `S`;
CREATE TABLE `S` (
`Wno` varchar(10) default NULL,
`Pno` varchar(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of s
-- ----------------------------
INSERT INTO `S` VALUES ('1101', '101');
INSERT INTO `S` VALUES ('1102', '102');
INSERT INTO `S` VALUES ('1103', '103');
INSERT INTO `S` VALUES ('1104', '104');
INSERT INTO `S` VALUES ('1105', '105');
-- ----------------------------
-- Table structure for `w`
-- ----------------------------
DROP TABLE IF EXISTS `W`;
CREATE TABLE `W` (
`Wno` varchar(10) NOT NULL,
`Wname` varchar(9) default NULL,
`Waddress` varchar(8) default NULL,
PRIMARY KEY (`Wno`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of w
-- ----------------------------
INSERT INTO `W` VALUES ('1101', '仓库1', '上海');
INSERT INTO `W` VALUES ('1102', '仓库2', '浙江');
INSERT INTO `W` VALUES ('1103', '仓库3', '上海');
INSERT INTO `W` VALUES ('1104', '仓库4', '浙江');
DROP TRIGGER IF EXISTS `trigger_d`;
DELIMITER ;;
CREATE TRIGGER `trigger_d` AFTER INSERT ON `D` FOR EACH ROW update P set P.Pstatus=''
;;
DELIMITER ;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment