day02rk
commit
40fab62c27
|
@ -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
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AnalysisProjectProfileManager">
|
||||
<option name="PROJECT_PROFILE" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<list size="0" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
</project>
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AnalysisProjectProfileManager">
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<scopes />
|
||||
<profiles>
|
||||
<profile profile_name="Project Default" version="1.0" is_locked="false" />
|
||||
</profiles>
|
||||
<list size="0" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>day02rk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue