项目结构
1.mysql数据库 stuinfo
1 /* 2 SQLyog 企业版 - MySQL GUI v8.14 3 MySQL - 5.5.40 : Database - stuinfo 4 ********************************************************************* 5 */ 6 7 CREATE DATABASE /*!32312 IF NOT EXISTS*/`stuinfo` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */; 8 9 USE `stuinfo`; 10 11 /*Table structure for table `classes` */ 12 13 DROP TABLE IF EXISTS `classes`; 14 15 CREATE TABLE `classes` ( 16 `id` int(12) NOT NULL AUTO_INCREMENT, 17 `name` varchar(11) COLLATE utf8_bin NOT NULL, 18 PRIMARY KEY (`id`) 19 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 20 21 /*Data for the table `classes` */ 22 23 insert into `classes`(`id`,`name`) values (1,'y2134'),(2,'s2188'),(3,'s2192'); 24 25 /*Table structure for table `student` */ 26 27 DROP TABLE IF EXISTS `student`; 28 29 CREATE TABLE `student` ( 30 `id` int(12) NOT NULL AUTO_INCREMENT COMMENT '学员编号', 31 `name` varchar(11) COLLATE utf8_bin NOT NULL COMMENT '姓名', 32 `age` int(12) NOT NULL COMMENT '年龄', 33 `gender` char(2) COLLATE utf8_bin NOT NULL COMMENT '性别', 34 `telephone` varchar(11) COLLATE utf8_bin NOT NULL COMMENT '电话', 35 `email` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'Email', 36 `classId` int(12) NOT NULL COMMENT '班级编号', 37 PRIMARY KEY (`id`), 38 KEY `FK_student` (`classId`), 39 CONSTRAINT `FK_student` FOREIGN KEY (`classId`) REFERENCES `classes` (`id`) 40 ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; 41 42 /*Data for the table `student` */ 43 44 insert into `student`(`id`,`name`,`age`,`gender`,`telephone`,`email`,`classId`) values (1,'何东东',20,'男','13910101000','hdd@accp.co',1),(2,'付好',23,'男','18856906326','fuhao@126.com',2),(3,'李建达',24,'男','18888888888','lijianda@qq.com',2),(4,'lucy',20,'女','15852033216','lucy@qq.com',3),(5,'李健',25,'男','13956063365','liyang1@126.com',2),(6,'李健康',20,'男','13956063369','lijiankang@126.com',1);