我的员工管理界面中,员工和小组属于多对一关系,小组和到部门属于多对一关系,这几张表关联在一块。
emp:
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50515
Source Host : localhost:3306
Source Database : message
Target Server Type : MYSQL
Target Server Version : 50515
File Encoding : 65001
Date: 2017-06-15 17:38:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `emp`
-- ----------------------------
DROP TABLE IF EXISTS `emp`;
CREATE TABLE `emp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`tid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `tid` (`tid`),
CONSTRAINT `tid` FOREIGN KEY (`tid`) REFERENCES `team` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=301004 DEFAULT CHARSET=utf8;
-- --------