From 358d95b54c579fca3a391669f3852f64732646e8 Mon Sep 17 00:00:00 2001 From: 86191 <2160251938@qq.com> Date: Thu, 18 Jul 2024 20:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E8=80=831?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 38 +++++++++++++++++++++++ .idea/.gitignore | 8 +++++ .idea/encodings.xml | 8 +++++ .idea/misc.xml | 15 +++++++++ pom.xml | 17 ++++++++++ sql/7-18考试SQL测试.sql | 48 +++++++++++++++++++++++++++++ src/main/java/org/example/Main.java | 7 +++++ 7 files changed, 141 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 pom.xml create mode 100644 sql/7-18考试SQL测试.sql create mode 100644 src/main/java/org/example/Main.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac288aa --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/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..13cdae7 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..277b42c --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.example + demo1 + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + diff --git a/sql/7-18考试SQL测试.sql b/sql/7-18考试SQL测试.sql new file mode 100644 index 0000000..ef4c592 --- /dev/null +++ b/sql/7-18考试SQL测试.sql @@ -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 = '女') \ 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..407f157 --- /dev/null +++ b/src/main/java/org/example/Main.java @@ -0,0 +1,7 @@ +package org.example; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file