当前位置:网站首页>SQL replying to comments
SQL replying to comments
2022-07-04 09:39:00 【Cold branches do not inhabit SX】
/* Navicat Premium Data Transfer Source Server : Local 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 ' Course no. ',
`cname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Course name ',
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, ' Soft work 1 class ');
INSERT INTO `class` VALUES (2, ' Soft work 2 class ');
-- ----------------------------
-- Table structure for grade
-- ----------------------------
DROP TABLE IF EXISTS `grade`;
CREATE TABLE `grade` (
`gno` int(5) NOT NULL AUTO_INCREMENT COMMENT ' Grade number ',
`kno` int(5) NULL DEFAULT NULL COMMENT ' Course no. ',
`sno` int(11) NULL DEFAULT NULL COMMENT ' Student number ',
`grade` int(5) NULL DEFAULT NULL COMMENT ' achievement ',
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 ' Course no. ',
`kname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Course name ',
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, ' Advanced Mathematics ');
INSERT INTO `kecheng` VALUES (2, ' Physics ');
INSERT INTO `kecheng` VALUES (3, ' English ');
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`rno` int(5) NOT NULL AUTO_INCREMENT COMMENT ' Role number ',
`rname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' The role of ',
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, ' Student ');
INSERT INTO `role` VALUES (2, ' Instructor ');
INSERT INTO `role` VALUES (3, ' Data manager ');
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`sno` int(11) NOT NULL AUTO_INCREMENT COMMENT ' Student number ',
`spassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '123' COMMENT ' password ',
`cno` int(5) NULL DEFAULT NULL COMMENT ' Class number ',
`sname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' full name ',
`age` int(3) NULL DEFAULT NULL COMMENT ' Age ',
`snative` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Native place ',
`health` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' A healthy state ',
`rno` int(5) NULL DEFAULT 1 COMMENT ' role ',
`hobby` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' hobby ',
`account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Student account number ',
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, ' Wang Wu ', 22, ' Hunan zhuzhou ', ' sad ', 1, ' Like playing games ', '103');
INSERT INTO `student` VALUES (4, '123', 1, ' Zhao si ', 21, ' Hunan zhuzhou ', ' health ', 1, ' football ', '104');
INSERT INTO `student` VALUES (5, '123', 1, ' Li Wu ', 22, ' Wuhan, Hubei ', ' health ', 1, NULL, '105');
INSERT INTO `student` VALUES (6, '123', 1, ' Li Liu ', 22, ' Wuhan, Hubei ', ' sad ', 1, ' play football ', '106');
INSERT INTO `student` VALUES (8, '123', 1, ' Li ba ', 19, ' Hunan zhuzhou ', ' optimistic ', 1, NULL, '108');
INSERT INTO `student` VALUES (9, '123', 1, ' Li Jiu ', 25, ' Hunan changsha ', ' optimistic ', 1, NULL, '109');
INSERT INTO `student` VALUES (10, '123', 1, ' Li Shi ', 26, ' Hunan changsha ', ' sad ', 1, NULL, '110');
INSERT INTO `student` VALUES (11, '123', 1, ' Li Xi ', 24, ' Hunan changsha ', ' optimistic ', 1, NULL, '111');
INSERT INTO `student` VALUES (12, '123', 1, ' Li Shier ', 24, ' Hunan changsha ', ' optimistic ', 1, NULL, '112');
INSERT INTO `student` VALUES (13, '123', 1, ' Li shisan ', 23, ' Hunan changsha ', ' sad ', 1, NULL, '113');
INSERT INTO `student` VALUES (14, '123', 1, ' Li Shishi ', 24, ' Hunan changsha ', ' health ', 1, NULL, '114');
INSERT INTO `student` VALUES (15, '123', 2, ' Li Shiwu ', 22, NULL, NULL, 1, NULL, '115');
INSERT INTO `student` VALUES (16, '123', 2, ' Huang Xing ', 21, ' huaihua ', ' Happy ', 1, ' Reading a book ', '116');
INSERT INTO `student` VALUES (17, '123', 1, ' Ouyang Kaka ', NULL, NULL, NULL, 1, NULL, '117');
INSERT INTO `student` VALUES (18, '123', 2, ' Zhou xiaopang ', NULL, NULL, NULL, 1, NULL, '118');
INSERT INTO `student` VALUES (21, '123', 2, ' White Department ', NULL, NULL, NULL, 1, NULL, '121');
INSERT INTO `student` VALUES (22, '123', 1, ' caustic soda ', NULL, NULL, NULL, 1, NULL, '122');
INSERT INTO `student` VALUES (23, '123', 1, ' Satan ', NULL, NULL, NULL, 1, NULL, '123');
INSERT INTO `student` VALUES (25, '123', 1, ' test ', 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, ' Xiao Ming ', NULL, NULL, NULL, 1, NULL, '127');
-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`tno` int(5) NOT NULL COMMENT ' Teacher number ',
`account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Teacher account ',
`tpassword` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Teacher password ',
`tname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' Teacher's name ',
`cno` int(5) NULL DEFAULT NULL COMMENT ' Class number ',
`rno` int(5) NULL DEFAULT NULL COMMENT ' Role number ',
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', ' Counselor Wang ', 1, 2);
INSERT INTO `teacher` VALUES (2, '1002', '123', ' Counselor Li ', 2, 2);
INSERT INTO `teacher` VALUES (3, 'admin', 'admin', ' Data manager ', NULL, 3);
SET FOREIGN_KEY_CHECKS = 1;
Query statement :
SELECT s.sno,s.spassword,s.sname,c.cname,s.age,s.snative,s.health,s.hobby,r.rname,
SUM(case when k.kname=' Advanced Mathematics ' then g.grade end ) as ' Advanced Mathematics ',
SUM(case when k.kname=' Physics ' then g.grade end ) as ' Physics ',
SUM(case when k.kname=' English ' then g.grade end ) as ' English '
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;
Result chart
边栏推荐
- Flutter tips: various fancy nesting of listview and pageview
- Tkinter Huarong Road 4x4 tutorial II
- Write a jison parser from scratch (1/10):jison, not JSON
- 浅谈Multus CNI
- Function comparison between cs5261 and ag9310 demoboard test board | cost advantage of cs5261 replacing ange ag9310
- 2022-2028 global strain gauge pressure sensor industry research and trend analysis report
- Global and Chinese market of bipolar generators 2022-2028: Research Report on technology, participants, trends, market size and share
- Hands on deep learning (38) -- realize RNN from scratch
- xxl-job惊艳的设计,怎能叫人不爱
- Analysis report on the development status and investment planning of China's modular power supply industry Ⓠ 2022 ~ 2028
猜你喜欢
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
How web pages interact with applets
Hands on deep learning (33) -- style transfer
法向量点云旋转
Reload CUDA and cudnn (for tensorflow and pytorch) [personal sorting summary]
智能网关助力提高工业数据采集和利用
Summary of small program performance optimization practice
HMS core helps baby bus show high-quality children's digital content to global developers
Some points needing attention in PMP learning
回复评论的sql
随机推荐
Hands on deep learning (35) -- text preprocessing (NLP)
Launpad | 基础知识
C # use ffmpeg for audio transcoding
Golang Modules
Analysis report on the development status and investment planning of China's modular power supply industry Ⓠ 2022 ~ 2028
Launchpad x | mode
Web端自动化测试失败原因汇总
C # use gdi+ to add text with center rotation (arbitrary angle)
Write a jison parser from scratch (6/10): parse, not define syntax
What is permission? What is a role? What are users?
Golang Modules
Golang 类型比较
Dynamic analysis and development prospect prediction report of high purity manganese dioxide in the world and China Ⓡ 2022 ~ 2027
查看CSDN个人资源下载明细
At the age of 30, I changed to Hongmeng with a high salary because I did these three things
Modules golang
Svg image quoted from CodeChina
Global and Chinese markets of hemoglobin analyzers in care points 2022-2028: Research Report on technology, participants, trends, market size and share
浅谈Multus CNI
LeetCode 74. Search 2D matrix