timetable.sql 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server : localhost
  4. Source Server Version : 50624
  5. Source Host : localhost:3306
  6. Source Database : timetable
  7. Target Server Type : MYSQL
  8. Target Server Version : 50624
  9. File Encoding : 65001
  10. Date: 2022-12-27 18:03:22
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for attendclass
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `attendclass`;
  17. CREATE TABLE `attendclass` (
  18. `attendclass_id` int(11) NOT NULL AUTO_INCREMENT,
  19. `attendclass_date` varchar(100) DEFAULT NULL,
  20. `attendclass_day` varchar(100) DEFAULT NULL,
  21. `attendclass_num` int(11) DEFAULT NULL,
  22. `attendclass_start` varchar(100) DEFAULT NULL,
  23. `attendclass_end` varchar(100) DEFAULT NULL,
  24. `teacher_id` int(11) DEFAULT NULL,
  25. `class_id` int(11) DEFAULT NULL,
  26. `course_id` int(11) DEFAULT NULL,
  27. `classroom_id` int(11) DEFAULT NULL,
  28. PRIMARY KEY (`attendclass_id`),
  29. KEY `fk_atttendclasswithclass` (`class_id`),
  30. KEY `fk_atttendclasswithteacher` (`teacher_id`),
  31. KEY `fk_atttendclasswithcourse` (`course_id`),
  32. KEY `fk_atttendclasswithclassroom` (`classroom_id`),
  33. CONSTRAINT `fk_atttendclasswithclass` FOREIGN KEY (`class_id`) REFERENCES `class` (`class_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  34. CONSTRAINT `fk_atttendclasswithclassroom` FOREIGN KEY (`classroom_id`) REFERENCES `classroom` (`classroom_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  35. CONSTRAINT `fk_atttendclasswithcourse` FOREIGN KEY (`course_id`) REFERENCES `course` (`course_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  36. CONSTRAINT `fk_atttendclasswithteacher` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`teacher_id`) ON DELETE CASCADE ON UPDATE CASCADE
  37. ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4;
  38. -- ----------------------------
  39. -- Records of attendclass
  40. -- ----------------------------
  41. INSERT INTO `attendclass` VALUES ('1', '2022-12-19', '1', '1', '8:00', '9:00', '1', '1', '1', '1');
  42. INSERT INTO `attendclass` VALUES ('2', '2022-12-19', '1', '2', '9:00', '10:00', '1', '1', '1', '1');
  43. INSERT INTO `attendclass` VALUES ('3', '2022-12-19', '1', '3', '10:00', '11:00', '1', '1', '1', '1');
  44. INSERT INTO `attendclass` VALUES ('4', '2022-12-19', '1', '4', '11:00', '12:00', '1', '1', '1', '1');
  45. INSERT INTO `attendclass` VALUES ('5', '2022-12-19', '1', '5', '14:00', '15:00', '1', '1', '1', '1');
  46. INSERT INTO `attendclass` VALUES ('6', '2022-12-19', '1', '6', '15:00', '16:00', '1', '1', '1', '1');
  47. INSERT INTO `attendclass` VALUES ('7', '2022-12-20', '2', '1', '8:00', '9:00', '1', '1', '1', '1');
  48. INSERT INTO `attendclass` VALUES ('8', '2022-12-20', '2', '2', '9:00', '10:00', '1', '1', '1', '1');
  49. INSERT INTO `attendclass` VALUES ('9', '2022-12-20', '2', '3', '10:00', '11:00', '1', '1', '1', '1');
  50. INSERT INTO `attendclass` VALUES ('10', '2022-12-20', '2', '4', '11:00', '12:00', '1', '1', '1', '1');
  51. INSERT INTO `attendclass` VALUES ('11', '2022-12-20', '2', '5', '14:00', '15:00', '1', '1', '1', '1');
  52. INSERT INTO `attendclass` VALUES ('12', '2022-12-20', '2', '6', '15:00', '16:00', '1', '1', '1', '1');
  53. INSERT INTO `attendclass` VALUES ('13', '2022-12-21', '3', '1', '8:00', '9:00', '1', '1', '1', '1');
  54. INSERT INTO `attendclass` VALUES ('14', '2022-12-21', '3', '2', '9:00', '10:00', '1', '1', '1', '1');
  55. INSERT INTO `attendclass` VALUES ('15', '2022-12-21', '3', '3', '10:00', '11:00', '1', '1', '1', '1');
  56. INSERT INTO `attendclass` VALUES ('16', '2022-12-21', '3', '4', '11:00', '12:00', '1', '1', '1', '1');
  57. INSERT INTO `attendclass` VALUES ('17', '2022-12-21', '3', '5', '14:00', '15:00', '1', '1', '1', '1');
  58. INSERT INTO `attendclass` VALUES ('18', '2022-12-21', '3', '6', '15:00', '16:00', '1', '1', '1', '1');
  59. INSERT INTO `attendclass` VALUES ('19', '2022-12-22', '4', '1', '8:00', '9:00', '1', '1', '1', '1');
  60. INSERT INTO `attendclass` VALUES ('20', '2022-12-22', '4', '2', '9:00', '10:00', '1', '1', '1', '1');
  61. INSERT INTO `attendclass` VALUES ('21', '2022-12-22', '4', '3', '10:00', '11:00', '1', '1', '1', '1');
  62. INSERT INTO `attendclass` VALUES ('22', '2022-12-22', '4', '4', '11:00', '12:00', '1', '1', '1', '1');
  63. INSERT INTO `attendclass` VALUES ('23', '2022-12-22', '4', '5', '14:00', '15:00', '1', '1', '1', '1');
  64. INSERT INTO `attendclass` VALUES ('24', '2022-12-22', '4', '6', '15:00', '16:00', '1', '1', '1', '1');
  65. INSERT INTO `attendclass` VALUES ('25', '2022-12-23', '5', '1', '8:00', '9:00', '1', '1', '1', '1');
  66. INSERT INTO `attendclass` VALUES ('26', '2022-12-23', '5', '2', '9:00', '10:00', '1', '1', '1', '1');
  67. INSERT INTO `attendclass` VALUES ('27', '2022-12-23', '5', '3', '10:00', '11:00', '1', '1', '1', '1');
  68. INSERT INTO `attendclass` VALUES ('28', '2022-12-23', '5', '4', '11:00', '12:00', '1', '1', '1', '1');
  69. INSERT INTO `attendclass` VALUES ('29', '2022-12-23', '5', '5', '14:00', '15:00', '1', '1', '1', '1');
  70. INSERT INTO `attendclass` VALUES ('30', '2022-12-23', '5', '6', '15:00', '16:00', '1', '1', '1', '1');
  71. -- ----------------------------
  72. -- Table structure for class
  73. -- ----------------------------
  74. DROP TABLE IF EXISTS `class`;
  75. CREATE TABLE `class` (
  76. `class_id` int(11) NOT NULL AUTO_INCREMENT,
  77. `class_name` varchar(100) DEFAULT NULL,
  78. PRIMARY KEY (`class_id`)
  79. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  80. -- ----------------------------
  81. -- Records of class
  82. -- ----------------------------
  83. INSERT INTO `class` VALUES ('1', '一班');
  84. -- ----------------------------
  85. -- Table structure for classroom
  86. -- ----------------------------
  87. DROP TABLE IF EXISTS `classroom`;
  88. CREATE TABLE `classroom` (
  89. `classroom_id` int(11) NOT NULL AUTO_INCREMENT,
  90. `classroom_name` varchar(100) DEFAULT NULL,
  91. PRIMARY KEY (`classroom_id`)
  92. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  93. -- ----------------------------
  94. -- Records of classroom
  95. -- ----------------------------
  96. INSERT INTO `classroom` VALUES ('1', '第一教室');
  97. -- ----------------------------
  98. -- Table structure for course
  99. -- ----------------------------
  100. DROP TABLE IF EXISTS `course`;
  101. CREATE TABLE `course` (
  102. `course_id` int(11) NOT NULL AUTO_INCREMENT,
  103. `course_name` varchar(100) DEFAULT NULL,
  104. PRIMARY KEY (`course_id`)
  105. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  106. -- ----------------------------
  107. -- Records of course
  108. -- ----------------------------
  109. INSERT INTO `course` VALUES ('1', '高数');
  110. -- ----------------------------
  111. -- Table structure for teacher
  112. -- ----------------------------
  113. DROP TABLE IF EXISTS `teacher`;
  114. CREATE TABLE `teacher` (
  115. `teacher_id` int(11) NOT NULL AUTO_INCREMENT,
  116. `teacher_name` varchar(100) DEFAULT NULL,
  117. PRIMARY KEY (`teacher_id`)
  118. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  119. -- ----------------------------
  120. -- Records of teacher
  121. -- ----------------------------
  122. INSERT INTO `teacher` VALUES ('1', '张老师');
  123. -- ----------------------------
  124. -- View structure for view_attendclass
  125. -- ----------------------------
  126. DROP VIEW IF EXISTS `view_attendclass`;
  127. CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_attendclass` AS select a.*
  128. ,(select class_name from class where class_id = a.class_id) as class_name
  129. ,(select course_name from course where course_id = a.course_id) as course_name
  130. ,(select classroom_name from classroom where classroom_id = a.classroom_id) as classroom_name
  131. ,(select teacher_name from teacher where teacher_id = a.teacher_id) as teacher_name
  132. from attendclass as a ;