文章目录
- 七、实现步骤
- (一)创建数据库与表
- 1、创建数据库
- 2、创建学校表
- 3、创建状态表
- 4、创建学生表
- 5、创建用户表
- 6、转储SQL文件
七、实现步骤
(一)创建数据库与表
1、创建数据库
- 在NaviCat里创建数据库student,设置字符集为utf8
2、创建学校表
- 创建t_college表
- 输入表记录
id |
name |
preident |
start_time |
telephone |
email |
address |
profile |
1 |
泸州职业技术学院 |
杨宗伟 |
2003-04-23 00:00:00 |
0830-3150397 |
[email protected] |
泸州市龙马潭区长桥路2号 |
泸州职业技术学院是经四川省人民政府批准、国家教育部备案的综合性公办普通高等学校。以全日制高职专科学历教育为主,兼顾成人学历教育、中外合作学历教育和社会培训,具有接收外国留学生资质和聘请外教专家资格。学校坐落于激流澎湃的长江之滨、沱江之畔,开设39个高职专科专业,在校生近15000人,占地1271亩,建设总投资25亿元,建筑总面积60万平方米,建筑总投资和办学条件跃居全省专科学校前列。 |
3、创建状态表
- 创建t_status表
- 输入表记录
id |
college |
version |
author |
telephone |
address |
email |
1 |
泸职院 |
V1.0 |
华卫 |
15892921170 |
泸职院信息工程学院 |
[email protected] |
4、创建学生表
- 创建t_student表
- 输入表记录
5、创建用户表
- 创建t_user表
- 输入表记录
6、转储SQL文件
- 转储SQL文件
- 查看SQL文件 - student.sql
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `t_college`;
CREATE TABLE `t_college` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '学校名称',
`president` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '校长',
`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '建校时间',
`telephone` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话',
`email` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '电子邮箱',
`address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '通讯地址',
`profile` varchar(10000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '学校简介',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
INSERT INTO `t_college` VALUES (1, '泸州职业技术学院', '杨宗伟', '2003-04-23 00:00:00', '0830-3150397', '[email protected]', '泸州市龙马潭区长桥路2号', '泸州职业技术学院是经四川省人民政府批准、国家教育部备案的综合性公办普通高等学校。以全日制高职专科学历教育为主,兼顾成人学历教育、中外合作学历教育和社会培训,具有接收外国留学生资质和聘请外教专家资格。学校坐落于激流澎湃的长江之滨、沱江之畔,开设39个高职专科专业,在校生近15000人,占地1271亩,建设总投资25亿元,建筑总面积60万平方米,建筑总投资和办学条件跃居全省专科学校前列。');
DROP TABLE IF EXISTS `t_status`;
CREATE TABLE `t_status` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`college` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学校名称',
`version` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '系统版本',
`author` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '作者',
`telephone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话',
`address` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '通讯地址',
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
INSERT INTO `t_status` VALUES (1, '泸职院', 'V1.0', '华卫', '15892921170', '泸职院信息工程学院', '[email protected]');
DROP TABLE IF EXISTS `t_student`;
CREATE TABLE `t_student` (
`id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学号',
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
`sex` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别',
`age` int(11) NULL DEFAULT NULL COMMENT '年龄',
`class` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班级',
`department` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '系部',
`telephone` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
INSERT INTO `t_student` VALUES ('19204091', '黄运', '男', 18, '2019计应1班', '信息工程学院', '17318654033');
INSERT INTO `t_student` VALUES ('19204188', '张航', '男', 19, '2019计应3班', '信息工程学院', '15808230272');
INSERT INTO `t_student` VALUES ('19204189', '黄晓辉', '男', 17, '2019计应2班', '信息工程学院', '15182614160');
INSERT INTO `t_student` VALUES ('19204193', '周天宇', '男', 18, '2019计应3班', '信息工程学院', '15281314950');
INSERT INTO `t_student` VALUES ('19204196', '吴霜龙', '男', 18, '2019计应5班', '信息工程学院', '15283002142');
INSERT INTO `t_student` VALUES ('19204204', '雷庭浩', '男', 19, '2019计应4班', '信息工程学院', '18584193725');
INSERT INTO `t_student` VALUES ('19204205', '赖晓桐', '女', 19, '2019计应3班', '信息工程学院', '15828814625');
INSERT INTO `t_student` VALUES ('19204207', '杜雨露', '女', 19, '2019英教1班', '国际学院', '18716175667');
INSERT INTO `t_student` VALUES ('19204212', '魏先知', '男', 18, '2019英教2班', '国际学院', '15228935822');
INSERT INTO `t_student` VALUES ('19204219', '舒彬', '男', 20, '2019英教3班', '国际学院', '18383036430');
INSERT INTO `t_student` VALUES ('19204221', '李玉山', '男', 22, '2019英教2班', '国际学院', '15908362754');
INSERT INTO `t_student` VALUES ('19204225', '严贵川', '男', 18, '2019英教1班', '国际学院', '17360565517');
INSERT INTO `t_student` VALUES ('19204233', '林正川', '男', 18, '2019小教1班', '人文学院', '18715895290');
INSERT INTO `t_student` VALUES ('19204234', '陈桐', '男', 18, '2019小教2班', '人文学院', '15108181750');
INSERT INTO `t_student` VALUES ('19204236', '王川', '男', 17, '2019小教3班', '人文学院', '15328400375');
INSERT INTO `t_student` VALUES ('19204237', '吴梦英', '女', 19, '2019小教3班', '人文学院', '18048681302');
INSERT INTO `t_student` VALUES ('19204269', '朱虹菊', '女', 19, '2019小教3班', '人文学院', '15760637644');
INSERT INTO `t_student` VALUES ('19204295', '陈江', '女', 20, '2019小教3班', '人文学院', '18283412467');
INSERT INTO `t_student` VALUES ('19204301', '王良墁', '女', 10, '2019机电3班', '机械工程学院', '18380917891');
INSERT INTO `t_student` VALUES ('19204302', '邓力涓', '女', 19, '2019机电3班', '机械工程学院', '15183047291');
INSERT INTO `t_student` VALUES ('19204305', '雷宜', '女', 19, '2019机电3班', '机械工程学院', '19161537841');
INSERT INTO `t_student` VALUES ('19205010', '袁涛', '男', 19, '2019机电3班', '机械工程学院', '18090544532');
INSERT INTO `t_student` VALUES ('19205019', '袁小龙', '男', 18, '2019机电3班', '机械工程学院', '15760086865');
INSERT INTO `t_student` VALUES ('19205059', '贾杨庆', '女', 19, '2019应电3班', '电子工程学院', '13541336205');
INSERT INTO `t_student` VALUES ('19205091', '陈秋帆', '男', 18, '2019应电3班', '电子工程学院', '18383067893');
INSERT INTO `t_student` VALUES ('19205177', '彭卉', '女', 18, '2019应电3班', '电子工程学院', '13064386657');
INSERT INTO `t_student` VALUES ('19205178', '张艳琳', '女', 18, '2019应电3班', '电子工程学院', '18784994152');
INSERT INTO `t_student` VALUES ('19205183', '唐家明', '男', 19, '2019应电3班', '电子工程学院', '15908394072');
INSERT INTO `t_student` VALUES ('19205211', '刘宇', '男', 19, '2019应电3班', '电子工程学院', '19908253971');
INSERT INTO `t_student` VALUES ('19232301', '李冰', '男', 20, '2019数媒1班', '艺术传媒学院', '18919889973');
INSERT INTO `t_student` VALUES ('19232303', '李琦', '女', 18, '2019营销2班', '商学院', '18465639847');
INSERT INTO `t_student` VALUES ('19232304', '张琪琪', '女', 19, '2019营销1班', '商学院', '28373738292');
INSERT INTO `t_student` VALUES ('19232308', '张媛', '女', 20, '2019机电2班', '机械工程学院', '13474647888');
INSERT INTO `t_student` VALUES ('19232316', '张启东', '男', 18, '2019营销1班', '商学院', '13468998779');
INSERT INTO `t_student` VALUES ('19232319', '李三东', '男', 20, '2019机电2班', '机械工程学院', '12874648399');
INSERT INTO `t_student` VALUES ('19232392', '张云', '男', 19, '2019营销1班', '商学院', '14790463884');
INSERT INTO `t_student` VALUES ('19242005', '车昭勇', '男', 19, '2019电商3班', '商学院', '18483518775');
INSERT INTO `t_student` VALUES ('19242006\r\n', '罗茸瀚', '男', 18, '2019电商3班', '商学院', '17380873970');
INSERT INTO `t_student` VALUES ('19242009', '康鑫', '女', 19, '2019电商3班', '商学院', '17713750616');
INSERT INTO `t_student` VALUES ('19242020', '赵旭蔺', '男', 19, '2019数媒3班', '艺术传媒学院', '18384389937');
INSERT INTO `t_student` VALUES ('19242033', '裴东', '男', 18, '2019数媒1班', '艺术传媒学院', '19137925638');
INSERT INTO `t_student` VALUES ('19242048', '邓聪', '男', 18, '2019数媒3班', '艺术传媒学院', '18782682231');
INSERT INTO `t_student` VALUES ('19242066', '张希', '女', 19, '2019营销1班', '商学院', '13467858424');
INSERT INTO `t_student` VALUES ('19242067', '李娅侨', '女', 18, '2019数媒3班', '艺术传媒学院', '18381590816');
INSERT INTO `t_student` VALUES ('19242073', '李云', '男', 19, '2019数媒3班', '艺术传媒学院', '18328974944');
INSERT INTO `t_student` VALUES ('19242095', '刘亚玲', '女', 19, '2019数媒3班', '艺术传媒学院', '19283746478');
INSERT INTO `t_student` VALUES ('19242096', '陈杨敏', '女', 20, '2019计应3班', '信息工程学院', '15923369098');
INSERT INTO `t_student` VALUES ('19242097', '雷平', '男', 18, '2019计应3班', '信息工程学院', '13929387646');
INSERT INTO `t_student` VALUES ('19242098', '李昆华', '男', 19, '2019应电3班', '电子工程学院', '15283268376');
INSERT INTO `t_student` VALUES ('19242099', '张大东', '男', 20, '2019机电2班', '机械工程学院', '15838824597');
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`id` int(11) NOT NULL COMMENT '用户ID',
`username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
`password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码',
`telephone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
`register_time` timestamp NULL DEFAULT NULL COMMENT '注册时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户名',
`password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户密码',
`telephone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话',
`register_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '注册时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
INSERT INTO `t_user` VALUES (1, 'admin', 'admin', '15888781123', '2020-06-06 11:00:46');
INSERT INTO `t_user` VALUES (2, '王霞', '111111', '13990901140', '2020-06-06 11:00:49');
INSERT INTO `t_user` VALUES (3, '段誉', '222222', '12345678907', '2020-06-06 11:00:53');
INSERT INTO `t_user` VALUES (4, '郑琳', '333333', '13989891123', '2020-06-06 11:01:22');
INSERT INTO `t_user` VALUES (5, '李红', '444444', '15888781123', '2020-06-06 11:01:00');
INSERT INTO `t_user` VALUES (6, '唐安', '555555', '13853452232', '2020-06-06 11:01:27');
INSERT INTO `t_user` VALUES (7, '李国', '666666', '1234567890', '2020-06-06 11:03:54');
INSERT INTO `t_user` VALUES (8, '王平', '777777', '1234500000', '2020-06-06 11:01:12');
SET FOREIGN_KEY_CHECKS = 1;