master
86191 2024-07-18 20:56:03 +08:00
commit 358d95b54c
7 changed files with 141 additions and 0 deletions

38
.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/
.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

8
.idea/.gitignore vendored 100644
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -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>

15
.idea/misc.xml 100644
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

17
pom.xml 100644
View File

@ -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>org.example</groupId>
<artifactId>demo1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,48 @@
CREATE TABLE tb_student
(
student_id INT(11) PRIMARY KEY auto_increment,
student_name VARCHAR(30),
student_sex VARCHAR(20),
student_phone VARCHAR(30),
student_clazz_id INT(11),
student_age INT(11),
student_salary DECIMAL(10,2)
)
DROP TABLE tb_student
INSERT INTO tb_student(student_name,student_sex,student_phone,student_clazz_id,student_age,student_salary)
VALUES('王铭','','12345679812',20,36,5200.00);
INSERT INTO tb_student(student_name,student_sex,student_phone,student_clazz_id,student_age,student_salary)
VALUES('王虎','','19423568794',30,26,1314.00);
INSERT INTO tb_student(student_name,student_sex,student_phone,student_clazz_id,student_age,student_salary)
VALUES('小红','','18754632389',30,18,3600.00);
INSERT INTO tb_student(student_name,student_sex,student_phone,student_clazz_id,student_age,student_salary)
VALUES('曼萨','','13649876354',52,20,7777.00);
INSERT INTO tb_student(student_name,student_sex,student_phone,student_clazz_id,student_age,student_salary)
VALUES('钰萍','','12345679812',77,22,9999.00);
-- 查询所有学生信息,并根据年龄进行降序排序
SELECT * FROM tb_student ORDER BY student_age DESC
-- 显示姓王的学生的详细信息
SELECT * FROM tb_student WHERE student_name LIKE '王%'
-- 查询工资大于5000的所有男同学的信息
SELECT * FROM tb_student WHERE student_salary > 5000 AND student_sex = ''
-- 查询班级编号为20的男同学的电话号码。
SELECT student_phone FROM tb_student WHERE student_clazz_id = 20 AND student_sex = ''
-- 查询最低工资
SELECT MIN(student_salary) AS min_salary FROM tb_student
-- 查询班级为30的学生的最小年龄
SELECT MIN(student_age) FROM tb_student WHERE student_clazz_id = 30
-- 查询女生的最低工资
SELECT MIN(student_salary) AS min_salary FROM tb_student WHERE student_sex = ''
-- 查询女学生中薪资最低的人的全部信息
SELECT * FROM tb_student WHERE student_salary = (SELECT MIN(student_salary) FROM tb_student WHERE student_sex = '')

View File

@ -0,0 +1,7 @@
package org.example;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}