From 40fab62c2786634d5e16a2b80334828b42e48743 Mon Sep 17 00:00:00 2001
From: chentaisen <14615430+chentaisen@user.noreply.gitee.com>
Date: Fri, 19 Jul 2024 09:10:38 +0800
Subject: [PATCH] day02rk
---
.gitignore | 38 +++++++++
.idea/$PROJECT_FILE$ | 11 +++
.idea/.gitignore | 8 ++
.idea/encodings.xml | 8 ++
.idea/misc.xml | 20 +++++
.idea/qaplug_profiles.xml | 12 +++
.idea/vcs.xml | 6 ++
day02rk.sql | 133 +++++++++++++++++++++++++++++++
pom.xml | 17 ++++
src/main/java/com/bwie/Main.java | 7 ++
10 files changed, 260 insertions(+)
create mode 100644 .gitignore
create mode 100644 .idea/$PROJECT_FILE$
create mode 100644 .idea/.gitignore
create mode 100644 .idea/encodings.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/qaplug_profiles.xml
create mode 100644 .idea/vcs.xml
create mode 100644 day02rk.sql
create mode 100644 pom.xml
create mode 100644 src/main/java/com/bwie/Main.java
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/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..9e844e1
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/day02rk.sql b/day02rk.sql
new file mode 100644
index 0000000..54ad90d
--- /dev/null
+++ b/day02rk.sql
@@ -0,0 +1,133 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server : 106.54.193.225
+ Source Server Type : MySQL
+ Source Server Version : 50736
+ Source Host : 106.54.193.225:3306
+ Source Schema : day02rk
+
+ Target Server Type : MySQL
+ Target Server Version : 50736
+ File Encoding : 65001
+
+ Date: 19/07/2024 09:07:19
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for t_course
+-- ----------------------------
+DROP TABLE IF EXISTS `t_course`;
+CREATE TABLE `t_course` (
+ `course_id` int(11) NOT NULL AUTO_INCREMENT,
+ `course_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`course_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 4 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, '英语');
+
+-- ----------------------------
+-- Table structure for t_scope
+-- ----------------------------
+DROP TABLE IF EXISTS `t_scope`;
+CREATE TABLE `t_scope` (
+ `scope_id` int(11) NOT NULL AUTO_INCREMENT,
+ `course_id` int(11) NULL DEFAULT NULL,
+ `student_id` int(11) NULL DEFAULT NULL,
+ PRIMARY KEY (`scope_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_scope
+-- ----------------------------
+INSERT INTO `t_scope` VALUES (1, 1, 1);
+INSERT INTO `t_scope` VALUES (2, 1, 2);
+INSERT INTO `t_scope` VALUES (3, 1, 3);
+INSERT INTO `t_scope` VALUES (4, 2, 3);
+INSERT INTO `t_scope` VALUES (5, 2, 4);
+INSERT INTO `t_scope` VALUES (6, 2, 5);
+INSERT INTO `t_scope` VALUES (7, 3, 6);
+INSERT INTO `t_scope` VALUES (8, 3, 7);
+INSERT INTO `t_scope` VALUES (9, 3, 8);
+INSERT INTO `t_scope` VALUES (10, 3, 9);
+
+-- ----------------------------
+-- Table structure for t_student
+-- ----------------------------
+DROP TABLE IF EXISTS `t_student`;
+CREATE TABLE `t_student` (
+ `student_id` int(11) NOT NULL AUTO_INCREMENT,
+ `student_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ `student_sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+ PRIMARY KEY (`student_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 99 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, 'CVBS', '女');
+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;
+
+
+
+
+SELECT count(student_sex),student_sex count FROM t_student GROUP BY student_sex
+
+
+
+-- 3.查询男生和女生各多少人。(15分)
+SELECT count(student_sex) count,student_sex FROM t_student GROUP BY student_sex
+
+-- 4. 查询男生和女生分别占总人数的比例。(20分)
+SELECT count(student_id) count FROM t_student WHERE COUNT(student_sex) GROUP BY student_sex
+
+
+-- 5.查询每门课程下的学生总人数。(15分)
+
+SELECT
+ count(*),c.course_name
+FROM
+ t_scope s
+ LEFT JOIN t_course c ON s.course_id = c.course_id
+ LEFT JOIN t_student t ON t.student_id = s.student_id
+GROUP BY c.course_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..aff3703
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ com.bwie
+ day02rk
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+ UTF-8
+
+
+
diff --git a/src/main/java/com/bwie/Main.java b/src/main/java/com/bwie/Main.java
new file mode 100644
index 0000000..1287888
--- /dev/null
+++ b/src/main/java/com/bwie/Main.java
@@ -0,0 +1,7 @@
+package com.bwie;
+
+public class Main {
+ public static void main(String[] args) {
+ System.out.println("Hello world!");
+ }
+}
\ No newline at end of file