/*
 Navicat Premium Data Transfer

 Source Server         : localhost_connect
 Source Server Type    : MySQL
 Source Server Version : 80017
 Source Host           : localhost:3306
 Source Schema         : css

 Target Server Type    : MySQL
 Target Server Version : 80017
 File Encoding         : 65001

 Date: 20/05/2024 21:57:22
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_course
-- ----------------------------
DROP TABLE IF EXISTS `tb_course`;
CREATE TABLE `tb_course`  (
  `courseID` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程号',
  `courseName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '匿名' COMMENT '课程名',
  `courseNum` tinyint(4) NOT NULL COMMENT '课序号',
  `courseCredit` float NOT NULL DEFAULT 0 COMMENT '学分',
  `courseDesc` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程介绍',
  PRIMARY KEY (`courseID`, `courseNum`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_course
-- ----------------------------
INSERT INTO `tb_course` VALUES ('A1-101', '程序开发基础', 1, 4, 'A1-101, Program development foundation.');
INSERT INTO `tb_course` VALUES ('A1-101', '程序开发基础', 2, 4, 'A1-101, Program development foundation.');
INSERT INTO `tb_course` VALUES ('A2-201', '数据结构与算法', 1, 4, 'A2-201, Data structure and algorithm.');
INSERT INTO `tb_course` VALUES ('A2-201', '数据结构与算法', 2, 4, 'A2-201, Data structure and algorithm.');
INSERT INTO `tb_course` VALUES ('A2-202', '操作系统', 1, 4, 'A2-202, Operating system.');
INSERT INTO `tb_course` VALUES ('A2-202', '操作系统', 2, 4, 'A2-202, Operating system.');
INSERT INTO `tb_course` VALUES ('A2-203', '计算机组成', 1, 3, 'A2-203, Computer composition.');
INSERT INTO `tb_course` VALUES ('A2-203', '计算机组成', 2, 3, 'A2-203, Computer composition.');
INSERT INTO `tb_course` VALUES ('S1-103', '面向对象程序设计', 1, 4, 'S1-103, Object-oriented programming.');
INSERT INTO `tb_course` VALUES ('S1-103', '面向对象程序设计', 2, 4, 'S1-103, Object-oriented programming.');
INSERT INTO `tb_course` VALUES ('S2-301', '数据库', 1, 4, 'S2-301, database.');
INSERT INTO `tb_course` VALUES ('S2-301', '数据库', 2, 4, 'S2-301, database.');
INSERT INTO `tb_course` VALUES ('S2-302', '计算机网络', 1, 4, 'S2-302, computer network.');
INSERT INTO `tb_course` VALUES ('S2-302', '计算机网络', 2, 4, 'S2-302, computer network.');
INSERT INTO `tb_course` VALUES ('S2-303', '软件工程导论', 1, 3, 'S2-303, ntroduction to Software Engineering.');
INSERT INTO `tb_course` VALUES ('S2-303', '软件工程导论', 2, 3, 'S2-303, ntroduction to Software Engineering.');

-- ----------------------------
-- Table structure for tb_manager
-- ----------------------------
DROP TABLE IF EXISTS `tb_manager`;
CREATE TABLE `tb_manager`  (
  `managerID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工号',
  `managerName` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '匿名' COMMENT '姓名',
  `managerPswd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '123456' COMMENT '密码',
  PRIMARY KEY (`managerID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_manager
-- ----------------------------
INSERT INTO `tb_manager` VALUES ('admin', 'admin', '123456');

-- ----------------------------
-- Table structure for tb_student
-- ----------------------------
DROP TABLE IF EXISTS `tb_student`;
CREATE TABLE `tb_student`  (
  `studentID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学号',
  `studentName` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '匿名' COMMENT '姓名',
  `studentSex` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '男' COMMENT '性别',
  `studentAge` tinyint(4) NOT NULL DEFAULT 18 COMMENT '年龄',
  `studentPswd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '123456' COMMENT '密码',
  PRIMARY KEY (`studentID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_student
-- ----------------------------
INSERT INTO `tb_student` VALUES ('202101', '王铭', '男', 20, '123456');
INSERT INTO `tb_student` VALUES ('202201', '李明', '男', 20, '123456');
INSERT INTO `tb_student` VALUES ('202202', '刘成刚', '男', 19, '123456');
INSERT INTO `tb_student` VALUES ('202301', '李铭', '男', 18, '123456');
INSERT INTO `tb_student` VALUES ('202302', '刘晓鸣', '男', 19, '123456');
INSERT INTO `tb_student` VALUES ('202303', '张鹰', '女', 19, '123456');
INSERT INTO `tb_student` VALUES ('202304', '刘竟静', '女', 18, '123456');
INSERT INTO `tb_student` VALUES ('202305', '宣明尼', '女', 18, '123456');
INSERT INTO `tb_student` VALUES ('202306', '柳红利', '女', 19, '123456');
INSERT INTO `tb_student` VALUES ('202307', '匿名', '男', 18, '123456');

-- ----------------------------
-- Table structure for tb_student_course
-- ----------------------------
DROP TABLE IF EXISTS `tb_student_course`;
CREATE TABLE `tb_student_course`  (
  `studentID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学号',
  `courseID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程号',
  `courseNum` tinyint(4) NOT NULL COMMENT '课序号',
  `grade` smallint(6) NULL DEFAULT -1 COMMENT '成绩',
  PRIMARY KEY (`studentID`, `courseID`, `courseNum`) USING BTREE,
  INDEX `courseID`(`courseID`, `courseNum`) USING BTREE,
  CONSTRAINT `tb_student_course_ibfk_1` FOREIGN KEY (`studentID`) REFERENCES `tb_student` (`studentID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `tb_student_course_ibfk_2` FOREIGN KEY (`courseID`, `courseNum`) REFERENCES `tb_course` (`courseID`, `courseNum`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_student_course
-- ----------------------------
INSERT INTO `tb_student_course` VALUES ('202201', 'S2-301', 1, 92);
INSERT INTO `tb_student_course` VALUES ('202201', 'S2-302', 1, -1);
INSERT INTO `tb_student_course` VALUES ('202201', 'S2-303', 1, 90);
INSERT INTO `tb_student_course` VALUES ('202202', 'S2-301', 2, -1);
INSERT INTO `tb_student_course` VALUES ('202202', 'S2-302', 1, -1);
INSERT INTO `tb_student_course` VALUES ('202202', 'S2-303', 2, 85);
INSERT INTO `tb_student_course` VALUES ('202301', 'S1-103', 1, -1);

-- ----------------------------
-- Table structure for tb_teacher
-- ----------------------------
DROP TABLE IF EXISTS `tb_teacher`;
CREATE TABLE `tb_teacher`  (
  `teacherID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工号',
  `teacherName` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '匿名' COMMENT '姓名',
  `teacherSex` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '男' COMMENT '性别',
  `teacherPswd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '123456' COMMENT '密码',
  PRIMARY KEY (`teacherID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_teacher
-- ----------------------------
INSERT INTO `tb_teacher` VALUES ('200008', '黄武', '男', '123456');
INSERT INTO `tb_teacher` VALUES ('200015', '陈蓉', '女', '200015');
INSERT INTO `tb_teacher` VALUES ('200305', '熊运余', '男', '200305');
INSERT INTO `tb_teacher` VALUES ('200407', '何军', '男', '200407');
INSERT INTO `tb_teacher` VALUES ('200710', '李晓华', '女', '200710');
INSERT INTO `tb_teacher` VALUES ('200901', '林兰', '女', '200901');

-- ----------------------------
-- Table structure for tb_teacher_course
-- ----------------------------
DROP TABLE IF EXISTS `tb_teacher_course`;
CREATE TABLE `tb_teacher_course`  (
  `teacherID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工号',
  `courseID` char(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程号',
  `courseNum` tinyint(4) NOT NULL COMMENT '课序号',
  PRIMARY KEY (`courseID`, `courseNum`) USING BTREE,
  INDEX `teacherID`(`teacherID`) USING BTREE,
  CONSTRAINT `tb_teacher_course_ibfk_1` FOREIGN KEY (`teacherID`) REFERENCES `tb_teacher` (`teacherID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `tb_teacher_course_ibfk_2` FOREIGN KEY (`courseID`, `courseNum`) REFERENCES `tb_course` (`courseID`, `courseNum`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tb_teacher_course
-- ----------------------------
INSERT INTO `tb_teacher_course` VALUES ('200015', 'S2-301', 1);
INSERT INTO `tb_teacher_course` VALUES ('200015', 'S2-303', 2);
INSERT INTO `tb_teacher_course` VALUES ('200305', 'S2-302', 2);
INSERT INTO `tb_teacher_course` VALUES ('200407', 'S1-103', 1);
INSERT INTO `tb_teacher_course` VALUES ('200407', 'S2-301', 2);
INSERT INTO `tb_teacher_course` VALUES ('200710', 'S1-103', 2);
INSERT INTO `tb_teacher_course` VALUES ('200710', 'S2-303', 1);
INSERT INTO `tb_teacher_course` VALUES ('200901', 'S2-302', 1);


SET FOREIGN_KEY_CHECKS = 1;
