commit 6cb7fff23cab756a9a37f512f2fa1e2d42f1f065
Author: WeiRan <2392355487@qq.com>
Date: Fri Jul 19 10:08:08 2024 +0800
日考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..af625c2
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..81c1fc4
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml
new file mode 100644
index 0000000..3dfd21f
--- /dev/null
+++ b/.idea/qaplug_profiles.xml
@@ -0,0 +1,465 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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/pom.xml b/pom.xml
new file mode 100644
index 0000000..2190e81
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ org.example
+ day2
+ 1.0-SNAPSHOT
+
+
+ 17
+ 17
+ UTF-8
+
+
+
diff --git a/sql/day.sql b/sql/day.sql
new file mode 100644
index 0000000..1b288e0
--- /dev/null
+++ b/sql/day.sql
@@ -0,0 +1,61 @@
+create table t_student(
+s_id int(11) PRIMARY KEY auto_increment,
+s_name VARCHAR(50),
+sex VARCHAR(10)
+)
+
+create table t_course(
+c_id int(11) PRIMARY KEY auto_increment,
+c_name VARCHAR(100)
+)
+
+CREATE TABLE stu_cou(
+sc_id int(11) PRIMARY KEY auto_increment,
+c_id int(11),
+s_id int(11)
+)
+
+INSERT into t_student VALUES
+(0,'学生1','男'),
+(0,'学生2','男'),
+(0,'学生3','女'),
+(0,'学生4','女'),
+(0,'学生5','男'),
+(0,'学生6','男'),
+(0,'学生7','女'),
+(0,'学生8','男'),
+(0,'学生9','女'),
+(0,'学生10','男');
+
+INSERT into t_course VALUES
+(0,'语文'),
+(0,'数学'),
+(0,'日语');
+
+
+INSERT INTO stu_cou VALUES
+(0,1,1),
+(0,1,2),
+(0,1,3),
+(0,2,4),
+(0,2,5),
+(0,2,6),
+(0,3,7),
+(0,3,8),
+(0,3,9),
+(0,3,10);
+-- 查询男生和女生各多少人
+SELECT sex,COUNT(t_student.s_name) from t_student GROUP BY sex
+
+-- 查询男生和女生分别占总人数的比例
+SELECT sex,ROUND(COUNT(t_student.s_name)/(SELECT COUNT(t_student.s_name) from t_student)* 100,2) from t_student GROUP BY sex
+
+-- 查询每门课程下的学生总人数
+SELECT
+ t_course.c_name,
+ COUNT( t_student.s_name )
+FROM
+ t_student
+ LEFT JOIN stu_cou ON t_student.s_id = stu_cou.s_id
+ left join t_course on stu_cou.c_id=t_course.c_id
+ GROUP BY t_course.c_name
\ No newline at end of file
diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java
new file mode 100644
index 0000000..87b5874
--- /dev/null
+++ b/src/main/java/org/example/Main.java
@@ -0,0 +1,14 @@
+package org.example;
+
+/**
+ * @Author:weiran
+ * @Package:org.example
+ * @Project:Default (Template) Project
+ * @name:${NAME}
+ * @Date:2024/7/19 10:05
+ */
+public class Main {
+ public static void main(String[] args) {
+ System.out.println("Hello world!");
+ }
+}
diff --git a/理论/img.png b/理论/img.png
new file mode 100644
index 0000000..7b0f23f
Binary files /dev/null and b/理论/img.png differ