当前位置:网站首页>回复评论的sql
回复评论的sql
2022-07-04 09:32:00 【寒枝不栖sx】
/* Navicat Premium Data Transfer Source Server : 本地 Source Server Type : MySQL Source Server Version : 50536 Source Host : localhost:3306 Source Schema : datamanagement Target Server Type : MySQL Target Server Version : 50536 File Encoding : 65001 Date: 28/06/2022 20:27:33 */
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for class
-- ----------------------------
DROP TABLE IF EXISTS `class`;
CREATE TABLE `class` (
`cno` int(5) NOT NULL AUTO_INCREMENT COMMENT '课程号',
`cname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课程名',
PRIMARY KEY (`cno`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of class
-- ----------------------------
INSERT INTO `class` VALUES (1, '软工1班');
INSERT INTO `class` VALUES (2, '软工2班');
-- ----------------------------
-- Table structure for grade
-- ----------------------------
DROP TABLE IF EXISTS `grade`;
CREATE TABLE `grade` (
`gno` int(5) NOT NULL AUTO_INCREMENT COMMENT '成绩号',
`kno` int(5) NULL DEFAULT NULL COMMENT '课程号',
`sno` int(11) NULL DEFAULT NULL COMMENT '学号',
`grade` int(5) NULL DEFAULT NULL COMMENT '成绩',
PRIMARY KEY (`gno`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 80 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of grade
-- ----------------------------
INSERT INTO `grade` VALUES (7, 1, 3, 61);
INSERT INTO `grade` VALUES (8, 2, 3, 96);
INSERT INTO `grade` VALUES (9, 3, 3, 45);
INSERT INTO `grade` VALUES (10, 1, 4, 69);
INSERT INTO `grade` VALUES (11, 2, 4, 98);
INSERT INTO `grade` VALUES (12, 3, 4, 100);
INSERT INTO `grade` VALUES (13, 1, 5, 63);
INSERT INTO `grade` VALUES (14, 2, 5, 95);
INSERT INTO `grade` VALUES (15, 3, 5, 62);
INSERT INTO `grade` VALUES (16, 1, 6, 46);
INSERT INTO `grade` VALUES (17, 2, 6, 80);
INSERT INTO `grade` VALUES (18, 3, 6, 59);
INSERT INTO `grade` VALUES (22, 1, 8, 55);
INSERT INTO `grade` VALUES (23, 2, 8, 77);
INSERT INTO `grade` VALUES (24, 3, 8, 88);
INSERT INTO `grade` VALUES (25, 1, 9, 65);
INSERT INTO `grade` VALUES (26, 2, 9, 100);
INSERT INTO `grade` VALUES (27, 3, 9, 23);
INSERT INTO `grade` VALUES (28, 1, 10, 56);
INSERT INTO `grade` VALUES (29, 2, 10, 85);
INSERT INTO `grade` VALUES (30, 3, 10, 98);
INSERT INTO `grade` VALUES (31, 1, 11, 45);
INSERT INTO `grade` VALUES (32, 2, 11, 12);
INSERT INTO `grade` VALUES (33, 3, 11, 10);
INSERT INTO `grade` VALUES (34, 1, 12, 48);
INSERT INTO `grade` VALUES (35, 2, 12, 56);
INSERT INTO `grade` VALUES (36, 3, 12, 78);
INSERT INTO `grade` VALUES (37, 1, 13, 68);
INSERT INTO `grade` VALUES (38, 2, 13, 32);
INSERT INTO `grade` VALUES (39, 3, 13, 65);
INSERT INTO `grade` VALUES (40, 1, 14, 98);
INSERT INTO `grade` VALUES (41, 2, 14, 65);
INSERT INTO `grade` VALUES (42, 3, 14, 45);
INSERT INTO `grade` VALUES (44, 1, 16, 92);
INSERT INTO `grade` VALUES (45, 2, 16, 99);
INSERT INTO `grade` VALUES (46, 3, 16, 66);
INSERT INTO `grade` VALUES (47, 1, 17, 96);
INSERT INTO `grade` VALUES (48, 2, 17, 88);
INSERT INTO `grade` VALUES (49, 3, 17, 98);
INSERT INTO `grade` VALUES (50, 1, 18, 85);
INSERT INTO `grade` VALUES (51, 2, 18, 60);
INSERT INTO `grade` VALUES (52, 3, 18, 61);
INSERT INTO `grade` VALUES (59, 1, 21, 68);
INSERT INTO `grade` VALUES (60, 2, 21, 56);
INSERT INTO `grade` VALUES (61, 3, 21, 56);
INSERT INTO `grade` VALUES (62, 1, 22, 65);
INSERT INTO `grade` VALUES (63, 2, 22, 73);
INSERT INTO `grade` VALUES (64, 3, 22, 58);
INSERT INTO `grade` VALUES (65, 1, 23, 56);
INSERT INTO `grade` VALUES (66, 2, 23, 67);
INSERT INTO `grade` VALUES (67, 3, 23, 89);
INSERT INTO `grade` VALUES (71, 1, 25, 65);
INSERT INTO `grade` VALUES (72, 2, 25, 98);
INSERT INTO `grade` VALUES (73, 3, 25, 100);
INSERT INTO `grade` VALUES (74, 1, 26, 3);
INSERT INTO `grade` VALUES (75, 2, 26, 65);
INSERT INTO `grade` VALUES (76, 3, 26, 10);
INSERT INTO `grade` VALUES (77, 1, 27, 60);
INSERT INTO `grade` VALUES (78, 2, 27, 70);
INSERT INTO `grade` VALUES (79, 3, 27, 80);
-- ----------------------------
-- Table structure for kecheng
-- ----------------------------
DROP TABLE IF EXISTS `kecheng`;
CREATE TABLE `kecheng` (
`kno` int(5) NOT NULL AUTO_INCREMENT COMMENT '课程号',
`kname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课程名',
PRIMARY KEY (`kno`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of kecheng
-- ----------------------------
INSERT INTO `kecheng` VALUES (1, '高数');
INSERT INTO `kecheng` VALUES (2, '物理');
INSERT INTO `kecheng` VALUES (3, '英语');
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`rno` int(5) NOT NULL AUTO_INCREMENT COMMENT '角色号',
`rname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名',
PRIMARY KEY (`rno`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES (1, '学生');
INSERT INTO `role` VALUES (2, '辅导员');
INSERT INTO `role` VALUES (3, '资料管理员');
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`sno` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`spassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '123' COMMENT '密码',
`cno` int(5) NULL DEFAULT NULL COMMENT '班级号',
`sname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
`age` int(3) NULL DEFAULT NULL COMMENT '年龄',
`snative` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '籍贯',
`health` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '健康状态',
`rno` int(5) NULL DEFAULT 1 COMMENT '角色',
`hobby` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '爱好',
`account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学生账号',
PRIMARY KEY (`sno`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES (3, '123', 1, '王五', 22, '湖南株洲', '伤心', 1, '喜欢打游戏', '103');
INSERT INTO `student` VALUES (4, '123', 1, '赵四', 21, '湖南株洲', '健康', 1, '足球', '104');
INSERT INTO `student` VALUES (5, '123', 1, '李五', 22, '湖北武汉', '健康', 1, NULL, '105');
INSERT INTO `student` VALUES (6, '123', 1, '李六', 22, '湖北武汉', '伤心', 1, '踢足球', '106');
INSERT INTO `student` VALUES (8, '123', 1, '李八', 19, '湖南株洲', '开朗', 1, NULL, '108');
INSERT INTO `student` VALUES (9, '123', 1, '李九', 25, '湖南长沙', '开朗', 1, NULL, '109');
INSERT INTO `student` VALUES (10, '123', 1, '李十', 26, '湖南长沙', '伤心', 1, NULL, '110');
INSERT INTO `student` VALUES (11, '123', 1, '李十一', 24, '湖南长沙', '开朗', 1, NULL, '111');
INSERT INTO `student` VALUES (12, '123', 1, '李十二', 24, '湖南长沙', '开朗', 1, NULL, '112');
INSERT INTO `student` VALUES (13, '123', 1, '李十三', 23, '湖南长沙', '伤心', 1, NULL, '113');
INSERT INTO `student` VALUES (14, '123', 1, '李十四', 24, '湖南长沙', '健康', 1, NULL, '114');
INSERT INTO `student` VALUES (15, '123', 2, '李十五', 22, NULL, NULL, 1, NULL, '115');
INSERT INTO `student` VALUES (16, '123', 2, '黄行', 21, '湖南怀化', '开心', 1, '看书', '116');
INSERT INTO `student` VALUES (17, '123', 1, '欧阳卡卡', NULL, NULL, NULL, 1, NULL, '117');
INSERT INTO `student` VALUES (18, '123', 2, '周小胖', NULL, NULL, NULL, 1, NULL, '118');
INSERT INTO `student` VALUES (21, '123', 2, '白系', NULL, NULL, NULL, 1, NULL, '121');
INSERT INTO `student` VALUES (22, '123', 1, '大苏打', NULL, NULL, NULL, 1, NULL, '122');
INSERT INTO `student` VALUES (23, '123', 1, '撒旦', NULL, NULL, NULL, 1, NULL, '123');
INSERT INTO `student` VALUES (25, '123', 1, '测试', NULL, NULL, NULL, 1, NULL, '125');
INSERT INTO `student` VALUES (26, '123', 1, 'cedshi', NULL, NULL, NULL, 1, NULL, '126');
INSERT INTO `student` VALUES (27, '123', 1, '小明', NULL, NULL, NULL, 1, NULL, '127');
-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`tno` int(5) NOT NULL COMMENT '教师号',
`account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '教师账户',
`tpassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '教师密码',
`tname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '教师姓名',
`cno` int(5) NULL DEFAULT NULL COMMENT '班级号',
`rno` int(5) NULL DEFAULT NULL COMMENT '角色号',
PRIMARY KEY (`tno`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Records of teacher
-- ----------------------------
INSERT INTO `teacher` VALUES (1, '1001', '123', '王辅导员', 1, 2);
INSERT INTO `teacher` VALUES (2, '1002', '123', '李辅导员', 2, 2);
INSERT INTO `teacher` VALUES (3, 'admin', 'admin', '资料管理员', NULL, 3);
SET FOREIGN_KEY_CHECKS = 1;
查询语句:
SELECT s.sno,s.spassword,s.sname,c.cname,s.age,s.snative,s.health,s.hobby,r.rname,
SUM(case when k.kname='高数' then g.grade end ) as '高数',
SUM(case when k.kname='物理' then g.grade end ) as '物理',
SUM(case when k.kname='英语' then g.grade end ) as '英语'
from class c,grade g,kecheng k,student s,role r
where s.sno=g.sno and g.kno=k.kno and s.cno=c.cno and r.rno=s.rno GROUP BY sno;
结果图
边栏推荐
- Development trend and market demand analysis report of high purity tin chloride in the world and China Ⓔ 2022 ~ 2027
- Global and Chinese markets of water heaters in Saudi Arabia 2022-2028: Research Report on technology, participants, trends, market size and share
- Function comparison between cs5261 and ag9310 demoboard test board | cost advantage of cs5261 replacing ange ag9310
- LeetCode 74. Search 2D matrix
- AMLOGIC gsensor debugging
- What is uid? What is auth? What is a verifier?
- Research and investment strategy report of China's electronic hydrogen peroxide industry (2022 Edition)
- Multilingual Wikipedia website source code development part II
- How to display √ 2 on the command line terminal ̅? This is actually a blog's Unicode test article
- "How to connect the network" reading notes - Web server request and response (4)
猜你喜欢
HMS core helps baby bus show high-quality children's digital content to global developers
PHP personal album management system source code, realizes album classification and album grouping, as well as album image management. The database adopts Mysql to realize the login and registration f
Implementation principle of redis string and sorted set
2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report
[C Advanced] file operation (2)
AMLOGIC gsensor debugging
GoLand environment variable configuration
Some points needing attention in PMP learning
How do microservices aggregate API documents? This wave of show~
If you can quickly generate a dictionary from two lists
随机推荐
Global and Chinese market of air fryer 2022-2028: Research Report on technology, participants, trends, market size and share
2022-2028 global edible probiotic raw material industry research and trend analysis report
DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
How to ensure the uniqueness of ID in distributed environment
MySQL transaction mvcc principle
Upgrading Xcode 12 caused Carthage to build cartfile containing only rxswift to fail
Simulate EF dbcontext with MOQ - mocking EF dbcontext with MOQ
2022-2028 global gasket plate heat exchanger industry research and trend analysis report
"How to connect the Internet" reading notes - FTTH
China battery grade manganese sulfate Market Forecast and strategic consulting report (2022 Edition)
UML 时序图[通俗易懂]
2022-2028 global visual quality analyzer industry research and trend analysis report
Investment analysis and prospect prediction report of global and Chinese high purity tin oxide Market Ⓞ 2022 ~ 2027
Launpad | Basics
2022-2028 global industrial gasket plate heat exchanger industry research and trend analysis report
2022-2028 research and trend analysis report on the global edible essence industry
Mantis creates users without password options
Report on the development trend and prospect trend of high purity zinc antimonide market in the world and China Ⓕ 2022 ~ 2027
Global and Chinese market of planar waveguide optical splitter 2022-2028: Research Report on technology, participants, trends, market size and share
You can see the employment prospects of PMP project management