commit 00b627bf08de66b37039bb04f3a49e86994cc280
Author: Yueng <14617246+YuengMeYuuer@user.noreply.gitee.com>
Date: Fri Jul 19 09:57:05 2024 +0800
day_2
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/.idea/$PROJECT_FILE$ b/.idea/$PROJECT_FILE$
new file mode 100644
index 0000000..58b7e3e
--- /dev/null
+++ b/.idea/$PROJECT_FILE$
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63574ec
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..8d66637
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..2b05e07
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,23 @@
+
+
+
+ {
+ "isMigrated": true
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml
new file mode 100644
index 0000000..9a7566c
--- /dev/null
+++ b/.idea/qaplug_profiles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e7c60d8
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ com.bwie
+ day_2
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
diff --git a/sql/day_2.sql b/sql/day_2.sql
new file mode 100644
index 0000000..322d083
--- /dev/null
+++ b/sql/day_2.sql
@@ -0,0 +1,90 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : 110.41.47.6
+ Source Server Type : MySQL
+ Source Server Version : 50734
+ Source Host : 110.41.47.6:3306
+ Source Schema : day_2
+
+ Target Server Type : MySQL
+ Target Server Version : 50734
+ File Encoding : 65001
+
+ Date: 19/07/2024 09:08:24
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for stu_cou
+-- ----------------------------
+DROP TABLE IF EXISTS `stu_cou`;
+CREATE TABLE `stu_cou` (
+ `sc_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '选课ID',
+ `c_id` int(11) NULL DEFAULT NULL COMMENT '课程编号',
+ `s_id` int(11) NULL DEFAULT NULL COMMENT '学生',
+ PRIMARY KEY (`sc_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of stu_cou
+-- ----------------------------
+INSERT INTO `stu_cou` VALUES (1, 1, 1);
+INSERT INTO `stu_cou` VALUES (2, 1, 2);
+INSERT INTO `stu_cou` VALUES (3, 1, 3);
+INSERT INTO `stu_cou` VALUES (4, 2, 2);
+INSERT INTO `stu_cou` VALUES (5, 2, 5);
+INSERT INTO `stu_cou` VALUES (6, 3, 8);
+INSERT INTO `stu_cou` VALUES (7, 3, 7);
+INSERT INTO `stu_cou` VALUES (8, 3, 6);
+INSERT INTO `stu_cou` VALUES (9, 4, 2);
+INSERT INTO `stu_cou` VALUES (10, 4, 1);
+INSERT INTO `stu_cou` VALUES (11, 4, 9);
+INSERT INTO `stu_cou` VALUES (12, 2, 4);
+
+-- ----------------------------
+-- Table structure for t_course
+-- ----------------------------
+DROP TABLE IF EXISTS `t_course`;
+CREATE TABLE `t_course` (
+ `c_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '课程编号',
+ `c_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课程名称',
+ PRIMARY KEY (`c_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_course
+-- ----------------------------
+INSERT INTO `t_course` VALUES (1, '语文');
+INSERT INTO `t_course` VALUES (2, '数学');
+INSERT INTO `t_course` VALUES (3, '英语');
+INSERT INTO `t_course` VALUES (4, '政治');
+
+-- ----------------------------
+-- Table structure for t_student
+-- ----------------------------
+DROP TABLE IF EXISTS `t_student`;
+CREATE TABLE `t_student` (
+ `s_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学生ID',
+ `s_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学生姓名',
+ `s_sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学生性别',
+ PRIMARY KEY (`s_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_student
+-- ----------------------------
+INSERT INTO `t_student` VALUES (1, '张三', '男');
+INSERT INTO `t_student` VALUES (2, '李四', '男');
+INSERT INTO `t_student` VALUES (3, '张三', '女');
+INSERT INTO `t_student` VALUES (4, '李四', '男');
+INSERT INTO `t_student` VALUES (5, '张三', '男');
+INSERT INTO `t_student` VALUES (6, '李四', '男');
+INSERT INTO `t_student` VALUES (7, '张三', '男');
+INSERT INTO `t_student` VALUES (8, '李四', '男');
+INSERT INTO `t_student` VALUES (9, '王五', '女');
+INSERT INTO `t_student` VALUES (10, '赵六', '男');
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/sql/day_2.zip b/sql/day_2.zip
new file mode 100644
index 0000000..359a17b
Binary files /dev/null and b/sql/day_2.zip differ
diff --git a/sql/text.sql b/sql/text.sql
new file mode 100644
index 0000000..a32a222
--- /dev/null
+++ b/sql/text.sql
@@ -0,0 +1,61 @@
+CREATE DATABASES day_2
+
+USE day_2
+-- 学生表
+CREATE TABLE t_student(
+ s_id INT(50) AUTO_INCREMENT COMMENT'学生ID',
+ s_name VALUES(255) COMMENT'学生姓名',
+ s_sex VALUES(255) COMMENT'性别'
+)
+-- 课程表
+CREATE TABLE t_course(
+ s_id INT(50) AUTO_INCREMENT COMMENT'课程编号',
+ c_name VALUES(255) COMMENT'课程名称'
+)
+
+-- 选课表
+CREATE TABLE stu_cou(
+ sc_id INT(50) AUTO_INCREMENT COMMENT'选课ID',
+ c_id VALUES(255) COMMENT'课程编号',
+ s_id VALUES(255) COMMENT'学生'
+)
+
+-- 学生人数不少于10人。(10分)
+INSERT INTO t_student VALUES
+ (0, '张三', '男'),
+ (0, '李四', '男'),
+ (0, '张三', '女'),
+ (0, '李四', '男'),
+ (0, '张三', '男'),
+ (0, '李四', '男'),
+ (0, '张三', '男'),
+ (0, '李四', '男');
+-- 课程数量不少于3。(5分)
+INSERT INTO t_course VALUES
+ (0, '语文'),
+ (0, '数学'),
+ (0, '英语'),
+ (0, '政治');
+-- 每个学生可以选择多个课程,每门课程至少有3个学生。(15分)
+INSERT INTO stu_cou VALUES
+ (0, 1,1),
+ (0, 1,2),
+ (0, 1,3),
+ (0, 2,2),
+ (0, 2,5),
+ (0, 3,8),
+ (0, 3,7),
+ (0, 3,6),
+ (0, 4,2),
+ (0, 4,1),
+ (0, 4,9)
+
+-- 3.查询男生和女生各多少人。(15分)
+SELECT COUNT(s_sex),t.* FROM t_student t GROUP BY s_sex
+
+-- 4. 查询男生和女生分别占总人数的比例。(20分)
+SELECT AVG(t.s_id)/COUNT(s_sex) '总人数的比例',t.* FROM t_student t GROUP BY s_sex
+
+-- 5.查询每门课程下的学生总人数。(15分)
+SELECT t.*,COUNT(s.c_id) '课程人数' FROM stu_cou s LEFT JOIN t_student t ON s.s_id = t.s_id GROUP BY s.c_id
+
diff --git a/效果展示/效果展示.doc b/效果展示/效果展示.doc
new file mode 100644
index 0000000..f0696a5
Binary files /dev/null and b/效果展示/效果展示.doc differ