master
王鑫 2024-07-18 21:20:27 +08:00
commit f6eb98a164
5 changed files with 134 additions and 0 deletions

36
.gitignore vendored 100644
View File

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

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>com.muyu</groupId>
<artifactId>day01</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>

45
sql/rik01.sql 100644
View File

@ -0,0 +1,45 @@
/*
Navicat Premium Dump SQL
Source Server : localhost_3307
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : localhost:3307
Source Schema : rik01
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 18/07/2024 08:51:18
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for emp
-- ----------------------------
DROP TABLE IF EXISTS `emp`;
CREATE TABLE `emp` (
`eid` int NOT NULL AUTO_INCREMENT,
`ename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`tel` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`class_id` int NULL DEFAULT NULL,
`age` int NULL DEFAULT NULL,
`sal` decimal(10, 2) NULL DEFAULT NULL,
PRIMARY KEY (`eid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of emp
-- ----------------------------
INSERT INTO `emp` VALUES (1, '大武', '', '1', 20, 20, 10000.00);
INSERT INTO `emp` VALUES (2, '二五', '', '1', 30, 34, 1000.00);
INSERT INTO `emp` VALUES (3, '刘老三', '', '1', 20, 23, 40.00);
INSERT INTO `emp` VALUES (4, '李四', '', '1', 30, 56, 300.00);
INSERT INTO `emp` VALUES (5, '王五', '', '1', 30, 89, 2000.00);
INSERT INTO `emp` VALUES (6, '牛六', '', '1', 30, 56, 60000.00);
SET FOREIGN_KEY_CHECKS = 1;

36
sql/sql操作.sql 100644
View File

@ -0,0 +1,36 @@
-- 1.依据上图字段类型一致创建数据库添加至少5条数据。10分
INSERT INTO `rik01`.`emp`
(`ename`, `sex`, `tel`, `class_id`, `age`, `sal`)
VALUES
('1', '1', '1', 1, 1, 1.00),
('2', '1', '1', 1, 1, 1.00),
('3', '1', '1', 1, 1, 1.00),
('4', '1', '1', 1, 1, 1.00),
('5', '1', '1', 1, 1, 1.00);
-- 2.查询所有学生信息并根据年龄进行降序排序。10分
SELECT * FROM emp ORDER BY age desc;
-- 3.显示姓王的学生的详细信息。10分
SELECT * FROM emp WHERE ename LIKE CONCAT('%','','%')
-- 4.查询工资大于5000的所有男同学的信息。10分
SELECT * FROM emp WHERE sal > 5000
-- 5.查询班级编号为20的男同学的电话号码。10分
SELECT * FROM emp where class_id = 20
-- 6.查询最低工资。10分
SELECT min(sal) FROM emp
-- 7.查询班级为30的学生的最小年龄。10分
SELECT MIN(age) from emp where class_id = 30
-- 8.查询女生的最低工资。15分
SELECT MIN(sal) FROM emp where sex = ''
-- 9.查询女学生中薪资最低的人的全部信息。15分
SELECT * FROM emp where sex = '' AND sal = (SELECT MIN(sal) FROM emp where sex = '')

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB