MySQL 经典练习 50 题 (记录)

前言:

记录一下sql学习,仅供参考基本都对了,不排除有些我做的太快做错了。里面sql不存在任何sql优化操作,只以完成最后输出结果为目的,包含我做题过程和思路最后一行才是结果。

1.过程:

1.1.插入数据

/*
SQLyog Ultimate v13.1.1 (64 bit)
MySQL - 8.0.32 : Database - test
*********************************************************************
*//*!40101 SET NAMES utf8 */;/*!40101 SET SQL_MODE=''*/;/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`test` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;USE `test`;/*Table structure for table `course` */DROP TABLE IF EXISTS `course`;CREATE TABLE `course` (`c_id` varchar(20) NOT NULL,`c_name` varchar(20) NOT NULL DEFAULT '',`t_id` varchar(20) NOT NULL,PRIMARY KEY (`c_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;/*Data for the table `course` */insert  into `course`(`c_id`,`c_name`,`t_id`) values 
('01','语文','02'),
('02','数学','01'),
('03','英语','03'),
('04','化学','04'),
('05','物理','05'),
('06','生物','06');/*Table structure for table `dept` */DROP TABLE IF EXISTS `dept`;CREATE TABLE `dept` (`id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',`name` varchar(50) NOT NULL COMMENT '部门名称',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='部门表';/*Data for the table `dept` */insert  into `dept`(`id`,`name`) values 
(1,'研发部'),
(2,'市场部'),
(3,'财务部'),
(4,'销售部'),
(5,'总经办'),
(6,'人事部');/*Table structure for table `score` */DROP TABLE IF EXISTS `score`;CREATE TABLE `score` (`s_id` varchar(20) NOT NULL,`c_id` varchar(20) NOT NULL DEFAULT '',`s_score` int DEFAULT NULL,PRIMARY KEY (`s_id`,`c_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;/*Data for the table `score` */insert  into `score`(`s_id`,`c_id`,`s_score`) values 
('01','01',80),
('01','02',90),
('01','03',99),
('02','01',70),
('02','02',60),
('02','03',80),
('03','01',80),
('03','02',80),
('03','03',80),
('04','01',50),
('04','02',30),
('04','03',20),
('05','01',76),
('05','02',87),
('06','01',31),
('06','03',34),
('07','02',89),
('07','03',98);/*Table structure for table `student` */DROP TABLE IF EXISTS `student`;CREATE TABLE `student` (`s_id` varchar(20) NOT NULL,`s_name` varchar(20) NOT NULL DEFAULT '',`s_brith` varchar(20) NOT NULL DEFAULT '',`s_sex` varchar(10) NOT NULL DEFAULT '',PRIMARY KEY (`s_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;/*Data for the table `student` */insert  into `student`(`s_id`,`s_name`,`s_brith`,`s_sex`) values 
('01','赵雷','1990-01-01','男'),
('02','钱电','1990-12-21','男'),
('03','孙风','1990-05-20','男'),
('04','李云','1990-08-06','男'),
('05','周梅','1991-12-01','女'),
('06','吴兰','1992-03-01','女'),
('07','郑竹','1989-07-01','女'),
('08','王菊','1990-01-20','女'),
('09','lpq','2002-**-**','女'),
('10','lpq','2002-**-**','女');/*Table structure for table `teacher` */DROP TABLE IF EXISTS `teacher`;CREATE TABLE `teacher` (`t_id` varchar(20) NOT NULL,`t_name` varchar(20) NOT NULL DEFAULT '',PRIMARY KEY (`t_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;/*Data for the table `teacher` */insert  into `teacher`(`t_id`,`t_name`) values 
('01','张三'),
('02','李四'),
('03','王五');/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

1.2.解题过程 

USE test;//查询01课程比02课程成绩高的学生
SELECT * FROM score s WHERE s.c_id='01';
SELECT * FROM score s WHERE s.c_id='02';
SELECT * FROM student st LEFT JOIN (SELECT * FROM score s WHERE s.c_id='01') AS s1 ON s1.s_id=st.s_id  LEFT JOIN 
(SELECT * FROM score s WHERE s.c_id='02') AS s2 ON st.s_id=s2.s_id WHERE s1.s_score>s2.s_score;

//查询01课程比02课程成绩低的学生信息及课程分数
SELECT * FROM student st LEFT JOIN (SELECT * FROM score s WHERE s.c_id='01') AS s1 ON s1.s_id=st.s_id  LEFT JOIN 
(SELECT * FROM score s WHERE s.c_id='02') AS s2 ON st.s_id=s2.s_id WHERE s1.s_score<s2.s_score;

//查询平均分数大于等于60的同学的学生编号和学生姓名和平均成绩
SELECT s.s_id,AVG(s_score) AS _avg FROM score s GROUP BY s.s_id HAVING AVG(s.s_score)>=60;
SELECT st.*,s1._avg FROM student st JOIN (SELECT s.s_id,AVG(s_score) AS _avg FROM score s GROUP BY s.s_id HAVING AVG(s.s_score)>=60) AS s1
ON st.s_id=s1.s_id;

//查询平均成绩小于60的同学学生编号和学生姓名和平均成绩(包括有成绩和无成绩的)难度***
SELECT s.s_id,AVG(s_score) AS _avg FROM score s GROUP BY s.s_id HAVING AVG(s.s_score)<60;
SELECT * FROM student st LEFT JOIN (SELECT s.s_id,AVG(s_score) AS _avg FROM score s GROUP BY s.s_id HAVING AVG(s.s_score)) AS s1 ON 
s1.s_id=st.s_id WHERE s1._avg<60 OR s1._avg IS NULL;

//查询所有同学的学生编号、学生姓名、选课总数、所有课程总成绩
SELECT st.*,st2._sum,st2._count FROM student st LEFT JOIN (SELECT SUM(s.s_score) AS _sum,s.s_id,COUNT(*) AS _count FROM score s GROUP BY s.s_id)AS st2 ON st2.s_id=st.s_id;

 

//查询李性老师的数量
SELECT COUNT(*) FROM teacher t WHERE t.t_name LIKE '%李%'

//查询学过张三老师课程学生
SELECT st.* FROM score s JOIN course c ON s.c_id=c.c_id JOIN student st ON st.s_id=s.s_id WHERE c.t_id=(SELECT t.t_id FROM teacher AS t WHERE t.t_name='张三');

 

//查询没学过张三老师课程学生
//1.先查询学过的
SELECT st.s_id FROM student st JOIN score s ON st.s_id=s.s_id JOIN course c ON c.c_id=s.c_id JOIN teacher t ON t.t_id=c.t_id WHERE c.t_id  IN 
(SELECT t.t_id FROM teacher AS t WHERE t.t_name='张三');
//取反
SELECT * FROM student st WHERE st.s_id NOT IN(SELECT st.s_id FROM student st JOIN score s ON st.s_id=s.s_id JOIN course c ON c.c_id=s.c_id JOIN teacher t ON t.t_id=c.t_id WHERE c.t_id  IN 
(SELECT t.t_id FROM teacher AS t WHERE t.t_name='张三'))

剩下的就不一个个贴了。

//查询学过01和02课程学生信息
SELECT * FROM score s WHERE s.c_id='01';
SELECT * FROM score s WHERE s.c_id='02';
SELECT st.* FROM (SELECT * FROM score s WHERE s.c_id='01') st1 JOIN (SELECT * FROM score s WHERE s.c_id='02')
st2 ON st1.s_id=st2.s_id JOIN student st ON st.s_id =st1.s_id;//查询学过01但是没学过02的   有点难度***
SELECT st.* FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='01' AND s.s_id NOT IN (SELECT s.s_id FROM score s WHERE s.c_id='02')//查询没有学会全部课程的
SELECT s.s_id,COUNT(*) AS _count FROM score s GROUP BY s.s_id HAVING COUNT(*)!=3;
SELECT st.*,s1._count FROM student AS st LEFT JOIN (SELECT s.s_id,COUNT(*) AS _count FROM score s GROUP BY s.s_id) AS s1 ONst.s_id=s1.s_id WHERE  s1._count IS NULL OR s1._count!=3;//查询和01号同学学习完全相同的其他同学的信息
SELECT s.c_id FROM score s WHERE s.s_id='01';SELECT st.*,COUNT(*) FROM score s JOIN student st ON st.s_id=s.s_idWHERE s.c_id IN (SELECT s.c_id FROM score s WHERE s.s_id='01') AND s.s_id!='01' GROUP BY s.s_id HAVING COUNT(*)=3;//查询没学过张三老师讲授的任何一门课程的学生
SELECT c.c_id FROM teacher t JOIN course c ON c.t_id=t.t_id  WHERE t.t_name='张三'
SELECT s.s_id FROM score s WHERE s.c_id =(SELECT c.c_id FROM teacher t JOIN course c ON c.t_id=t.t_id  WHERE t.t_name='张三') GROUP BY 
s.s_id;
SELECT * FROM student st WHERE st.s_id NOT IN (SELECT s.s_id FROM score s WHERE s.c_id =(SELECT c.c_id FROM teacher t JOIN course c ON c.t_id=t.t_id  WHERE t.t_name='张三') GROUP BY 
s.s_id);//查询两门及其以上不及格课程的同学的学号,姓名及其平均成绩
SELECT s.s_id AS _count FROM score s WHERE s.s_score<60 GROUP BY s_id;
SELECT st.*,AVG(s.s_score) FROM student st JOIN score s ON st.s_id=s.s_id WHERE st.s_id IN (SELECT s.s_id AS _count FROM score s WHERE s.s_score<60 GROUP BY s_id)
GROUP BY st.s_id;//检索"01"课程分数小于60,按分数降序排列的学生信息
SELECT st.* FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='01' AND s.s_score<60 ORDER BY s.s_score DESC;//按平均成绩从高到低显示所有学生的所有课程的成绩以及平均成绩
SELECT st.s_id,s.s_score AS 语文 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='01';
SELECT st.s_id,s.s_score AS 数学 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='02';
SELECT st.s_id,s.s_score AS 英语 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='03';
SELECT st.*,IFNULL(s1.语文,0) AS 语文,IFNULL(s2.数学,0) AS 数学,IFNULL(s3.英语,0) AS 英语, (IFNULL(s1.语文, 0) + IFNULL(s2.数学, 0) + IFNULL(s3.英语, 0)) / 3 AS 平均分 FROM student st LEFT JOIN (SELECT st.s_id,s.s_score AS 语文 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='01') AS s1
ON st.s_id=s1.s_id LEFT JOIN (SELECT st.s_id,s.s_score AS 数学 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='02') AS s2
ON st.s_id=s2.s_id LEFT JOIN (SELECT st.s_id,s.s_score AS 英语 FROM score s JOIN student st ON st.s_id=s.s_id WHERE s.c_id='03') AS s3
ON st.s_id=s3.s_id//查询各科成绩最高分、最低分和平均分   //这题和标准答案不一样我随便写写,这种用代码写更好sql性能太消耗了
SELECT s.c_id,MAX(s.s_score)AS _max,MIN(s.s_score) AS _min,AVG(s.s_score) AS _avg FROM score s GROUP BY s.c_id;//按各科成绩进行排序,并显示排名
SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) FROM score s WHERE s.c_id='01'
SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) FROM score s WHERE s.c_id='02'
SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) FROM score s WHERE s.c_id='03'SELECT st.*,s1.语文,s2.数学,s3.英语 FROM student st LEFT JOIN (SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) AS 语文 FROM score s WHERE s.c_id='01') AS s1 ON
s1.s_id=st.s_id LEFT JOIN (SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) AS 数学 FROM score s WHERE s.c_id='02') AS s2 ON
s2.s_id=st.s_id LEFT JOIN (SELECT s.s_id,RANK() OVER(ORDER BY s.s_score DESC) AS 英语 FROM score s WHERE s.c_id='03') AS s3 ON
s3.s_id=st.s_id;//查询学生的总成绩并进行排名
SELECT SUM(s.s_score) AS _sum FROM score s GROUP BY s.s_id;
SELECT st.*,IFNULL(s2._sum,0) FROM student st LEFT JOIN (SELECT SUM(s.s_score) AS _sum,s.s_id FROM score s GROUP BY s.s_id) s2 ON s2.s_id=st.s_id ORDER BY _sum DESC;//查询不同老师所教不同课程平均分从高到低显示
SELECT t.t_name,s.c_id,AVG(s.s_score) AS _avg FROM score s JOIN course c ON c.c_id=s.c_id JOIN teacher t ON t.t_id=c.t_id GROUP BY s.c_id ORDER BY
_avg DESC;//查询所有课程的成绩第2名到第3名的学生信息及该课程成绩
//错误示例  ORDER BY limit只能在语句最后面  但是写成子查询c
SELECT * FROM score s WHERE s.c_id='01' ORDER BY s.s_score DESC LIMIT 1,2 UNION ALL 
SELECT * FROM score s WHERE s.c_id='02' ORDER BY s.s_score DESC LIMIT 1,2 UNION ALL
SELECT * FROM score s WHERE s.c_id='03' ORDER BY s.s_score DESC LIMIT 1,2SELECT * FROM (SELECT * FROM score s WHERE s.c_id='01' ORDER BY s.s_score DESC LIMIT 1,2) AS s1 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='02' ORDER BY s.s_score DESC LIMIT 1,2) AS s2 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='03' ORDER BY s.s_score DESC LIMIT 1,2) AS s3//统计各科成绩各分数段人数:课程编号,课程名称,[100-85],[85-70],[70-60],[0-60]及所占百分比
pass 程序更容易//查询学生平均成绩及其名次
SELECT st.*,RANK() OVER(ORDER BY AVG(s.s_score) DESC),AVG(s.s_score) FROM score s JOIN student st ON st.s_id=s.s_id GROUP BY s.s_id;//查询各科成绩前三名的记录
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='01' ORDER BY s.s_score DESC LIMIT 0,3) AS s1 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='02' ORDER BY s.s_score DESC LIMIT 0,3) AS s2 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='03' ORDER BY s.s_score DESC LIMIT 0,3) AS s3//查询每门课程被选修的学生数
SELECT s.c_id,COUNT(*) FROM score s GROUP BY s.c_id;//查询出只有两门课程的全部学生的学号和姓名
SELECT st.*,COUNT(*) FROM score s JOIN student st ON st.s_id=s.s_id GROUP BY s.s_id HAVING COUNT(*)=2;//查询男生、女生人数
SELECT st.s_sex,COUNT(*) FROM student st GROUP BY st.s_sex;//查询名字中含有"风"字的学生信息
SELECT * FROM student st WHERE st.s_name LIKE '%风%';//查询同名同性学生名单,并统计同名人数   //手动加入了lpq测试数据这里开始不一样了
SELECT * FROM student st1 JOIN student st2 ON st1.s_id!=st2.s_id AND st1.s_name=st2.s_name;//查询1990年出生的学生名单
SELECT * FROM student st WHERE YEAR(st.s_brith)=1990;//查询每门课程的平均成绩,结果按平均成绩降序排列,平均成绩相同时,按课程编号升序排列
SELECT s.c_id,AVG(s.s_score) AS _avg FROM score s GROUP BY s.c_id ORDER BY _avg DESC,s.c_id DESC;//查询平均成绩大于等于85的所有学生的学号、姓名和平均成绩
SELECT st.*,AVG(s.s_score) AS _avg FROM score s JOIN student st ON st.s_id=s.s_id GROUP BY st.s_id HAVING AVG(s.s_score)>=85;//查询课程名称为"数学",且分数低于60的学生姓名和分数  偷个懒知道数学是02
SELECT st.*,s.s_score FROM score s RIGHT JOIN student st ON st.s_id = s.s_id WHERE s.s_score<60 AND s.c_id='02';//查询所有学生的课程及分数情况
SELECT s.s_score AS 语文,s.s_id FROM score s WHERE s.c_id='01'
SELECT s.s_score AS 数学,s.s_id FROM score s WHERE s.c_id='02'
SELECT s.s_score AS 英语,s.s_id FROM score s WHERE s.c_id='03'
SELECT st.*,IFNULL(s1.语文,0),IFNULL(s2.数学,0),IFNULL(s3.英语,0) FROM student st 
LEFT JOIN (SELECT s.s_score AS 语文,s.s_id FROM score s WHERE s.c_id='01') AS s1 ON s1.s_id=st.s_id
LEFT JOIN (SELECT s.s_score AS 数学,s.s_id FROM score s WHERE s.c_id='02')AS s2 ON st.s_id=s2.s_id 
LEFT JOIN (SELECT s.s_score AS 英语,s.s_id FROM score s WHERE s.c_id='03')AS s3 ON st.s_id=s3.s_id //查询任何一门课程成绩在70分以上的学生姓名、课程名称和分数
SELECT s.s_id FROM score s WHERE s.s_score>70 GROUP BY s.s_id;
SELECT st.* FROM score s RIGHT JOIN student st ON st.s_id=s.s_id WHERE s.s_score>70 GROUP BY st.s_id;//查询课程不及格的学生
SELECT st.* FROM score s RIGHT JOIN student st ON st.s_id=s.s_id WHERE s.s_score<60 GROUP BY s.s_id;//查询课程编号为01且课程成绩在80分以上的学生的学号和姓名
SELECT * FROM score s WHERE s.s_score>80;
SELECT st.* FROM score s JOIN student st ON s.s_id=st.s_id WHERE s.s_score>80 AND s.c_id='01';//求每门课程的学生人数
SELECT s.c_id,COUNT(*) FROM score s GROUP BY s.c_id;//查询选修"张三"老师所授课程的学生中,成绩最高的学生信息及其成绩
SELECT c.c_id FROM teacher t JOIN course c ON c.t_id = t.t_id WHERE t.t_name='张三'
SELECT s.s_id,s.s_score FROM score s WHERE s.c_id= (SELECT c.c_id FROM teacher t JOIN course c ON c.t_id = t.t_id WHERE t.t_name='张三') ORDER BY s.s_score 
DESC LIMIT 1
SELECT st.*,s1.s_score FROM student st JOIN (SELECT s.s_id,s.s_score FROM score s WHERE s.c_id= (SELECT c.c_id FROM teacher t JOIN course c ON c.t_id = t.t_id WHERE t.t_name='张三') ORDER BY s.s_score 
DESC LIMIT 1) AS s1 ON st.s_id=s1.s_id;//查询不同课程成绩相同的学生的学生编号、课程编号、学生成绩  ***
SELECT s.s_score FROM score s GROUP BY s.s_score HAVING COUNT(*)>1;
SELECT * FROM score WHERE s_score IN (SELECT s.s_score FROM score s GROUP BY s.s_score HAVING COUNT(*)>1)//查询每门课程成绩最好的前三名
SELECT c_id FROM score GROUP BY c_id;
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='01' ORDER BY s.s_score DESC LIMIT 3) AS s1 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='02' ORDER BY s.s_score DESC LIMIT 3) AS s2 UNION ALL
SELECT * FROM (SELECT * FROM score s WHERE s.c_id='03' ORDER BY s.s_score DESC LIMIT 3)AS s3// 统计每门课程的学生选修人数(超过5人的课程才统计)
SELECT s.c_id,COUNT(*) FROM score s GROUP BY s.c_id HAVING COUNT(*)>5;//检索至少选修两门课程的学生学号
SELECT s.s_id,COUNT(*) FROM score s GROUP BY s.s_id HAVING COUNT(*)>=2;//查询选修了全部课程的学生信息
SELECT s.s_id, FROM score s GROUP BY s.s_id HAVING COUNT(*)=3;
SELECT * FROM student AS st WHERE st.s_id IN (SELECT s.s_id FROM score s GROUP BY s.s_id HAVING COUNT(*)=3)//查询各学生的年龄(周岁)  算个大概的
SELECT YEAR(NOW())
SELECT YEAR(NOW())-YEAR(st.s_brith) FROM student st;//  剩下4题没啥用不用了。

 总结

1.前面比较难,中间简单,最后有几个也挺难的。最后几题跟日期有关的我没做,这个用程序写更好。

2.仅供参考答案不一定对。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/287094.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

STM32之HAL开发——手动移植HAL库

HAL库移植步骤 创建目录 配置启动文件 在\Drivers\CMSIS\Device\ST\stm32f1xx\Source\Templates\ARM目录下&#xff0c;根据你的芯片型号选择对应的启动文件&#xff0c;不同容量大小的芯片&#xff0c;对应的启动文件也不一样。 注意&#xff1a;在HAL库中&#xff0c;不同容…

centos7二进制安装openstack train版本双网口五节点

这里写目录标题 材料准备宿主机安装KVM 网络规划硬件规划本案例局限性密码规划虚拟机准备网络准备centos7模板机准备 数据库安装安装rabbitMQ消息队列安装memcached服务安装Etcd安装keystone身份服务创建数据库用户keystone安装keystone组件创建admin并启动keystone监听验证key…

canvas画带透明度的直线和涂鸦

提示&#xff1a;canvas画线 文章目录 前言一、带透明度的直线和涂鸦总结 前言 一、带透明度的直线和涂鸦 test.html <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content…

堆排序(六大排序)

前面博客已经分享过堆的知识了&#xff0c;今天我们来分享堆排序。 堆排序 堆排序(Heapsort)是指利用堆积树&#xff08;堆&#xff09;这种数据结构所设计的一种排序算法&#xff0c;它是选择排序的一种。它是通过堆来进行选择数据。 ★★★需要注意的是排升序要建大堆&#…

【前端Vue】Vue3+Pinia小兔鲜电商项目第3篇:静态结构搭建和分类实现,1. 整体结构创建【附代码文档】

Vue3ElementPlusPinia开发小兔鲜电商项目完整教程&#xff08;附代码资料&#xff09;主要内容讲述&#xff1a;认识Vue3&#xff0c;使用create-vue搭建Vue3项目1. Vue3组合式API体验,2. Vue3更多的优势,1. 认识create-vue,2. 使用create-vue创建项目,1. setup选项的写法和执行…

苍穹外卖项目笔记

软件开发流程 需求分析&#xff1a;说明书和原型 设计&#xff1a;UI&#xff0c;数据库&#xff0c;接口设计 编码&#xff1a;项目代码&#xff0c;单元测试 测试&#xff1a;测试用例&#xff0c;测试报告 上线运维&#xff1a;软件环境安装&#xff0c;配置 软件环境…

IPhone让用户升级?网友你咋不降点!

最近一个热搜刷屏了我的朋友圈&#xff0c;我点开一看是苹果上架了全新“换代有来”页面&#xff0c;其主要表达了苹果用户可以将旧的iphone升级到全新的iphoe15上。并告诉贴心的给网友对比了一下换代的好处。 并且还详细了说了一些iPhone 11、11 Pro、11 Pro Max、12、12 mini…

【鸿蒙HarmonyOS开发笔记】使用@Preview装饰器预览组件

概述 ArkTS应用/服务支持组件预览&#xff0c;要求compileSdkVersion为8或以上。组件预览支持实时预览&#xff0c;不支持动态图和动态预览。组件预览通过在组件前添加注解Preview实现&#xff0c;在单个源文件中&#xff0c;最多可以使用10个Preview装饰自定义组件。 Preview…

EI级!高创新原创未发表!VMD-TCN-BiGRU-MATT变分模态分解卷积神经网络双向门控循环单元融合多头注意力机制多变量时间序列预测(Matlab)

EI级&#xff01;高创新原创未发表&#xff01;VMD-TCN-BiGRU-MATT变分模态分解卷积神经网络双向门控循环单元融合多头注意力机制多变量时间序列预测&#xff08;Matlab&#xff09; 目录 EI级&#xff01;高创新原创未发表&#xff01;VMD-TCN-BiGRU-MATT变分模态分解卷积神经…

Elastic 线下 Meetup 将于 2024 年 3 月 30 号在武汉举办

2024 Elastic Meetup 武汉站活动&#xff0c;由 Elastic、腾讯、新智锦绣联合举办&#xff0c;现诚邀广大技术爱好者及开发者参加。 活动时间 2024年3月30日 13:30-18:00 活动地点 中国武汉 武汉市江夏区腾讯大道1号腾讯武汉研发中心一楼多功能厅 13:30-14:00 入场 活动流程…

在基于Android相机预览的CV应用程序中使用 OpenCL

查看&#xff1a;OpenCV系列文章目录&#xff08;持续更新中......&#xff09; 上一篇&#xff1a;OpenCV4.9.0在Android 开发简介 下一篇&#xff1a;在 MacOS 中安装 本指南旨在帮助您在基于 Android 相机预览的 CV 应用程序中使用 OpenCL ™。教程是为 Android Studio 20…

javaWeb健康管理系统

一、引言 1.1 设计背景 紧张的工作节奏、教学和科研的压力、个人不良的工作生活习惯、以及伴随工作压力而来的家庭关系、人际关系紧张等因素使得高校群体成为慢性病的高发群体[1]。学生入学的定期体检&#xff0c;教职工人入职体检&#xff0c;以及所有学生和教职工的定期体检…

UI自动化_id 元素定位

## 导包selenium from selenium import webdriver import time1、创建浏览器驱动对象 driver webdriver.Chrome() 2、打开测试网站 driver.get("你公司的平台地址") 3、使浏览器窗口最大化 driver.maximize_window() 4、在用户名输入框中输入admin driver.find_ele…

去中心化的 AI 数据供应:认识Grass,参与Grass

去中心化的 AI 数据供应&#xff1a;认识Grass&#xff0c;参与Grass &#x1f44b;&#xff1a;邀请链接☘️&#xff1a;Intro❓&#xff1a;看好Grass和即将推出的L2的原因有哪些&#xff1f;&#x1f4a1;&#xff1a;展望&#x1f50d;&#xff1a;总结 &#x1f44b;&…

【Python】Data Science with Python 数据科学(1)环境搭建

一、操作系统 使用运行在Windows11主机上的Ubuntu 22.04虚拟机&#xff0c;虚拟化平台为Oracle VM VirtualBox。 二、PyCharm安装 有关PyCharm的安装和快捷方式创建&#xff0c;可分别参考我的博客 Ubuntu安装PyCharm、Ubuntu创建桌面快捷方式 &#xff0c;以及Ubuntu创建桌…

开源博客项目Blog .NET Core源码学习(11:App.Core项目结构分析)

开源博客项目Blog的App.Core项目主要定义数据库表对应的数据类&#xff0c;同时定义配置文件读取、日志记录、辅助缓存等辅助类。App.Core项目安装的Nuget包不多&#xff0c;仅包括SqlSugarCore和Microsoft.Extensions.DependencyInjectio两类。   App.Core项目的顶层文件夹如…

C++模版(基础)

目录 C泛型编程思想 C模版 模版介绍 模版使用 函数模版 函数模版基础语法 函数模版原理 函数模版实例化 模版参数匹配规则 类模版 类模版基础语法 C泛型编程思想 泛型编程&#xff1a;编写与类型无关的通用代码&#xff0c;是代码复用的一种手段。 模板是泛型编程…

解決flask-restful提示Did not attempt to load JSON data 问题

在使用flask-restfull进行API开发的时候。一旦我使用类似下面的代码从url或者form中获得参数就会出现报错&#xff1a;Did not attempt to load JSON data because the request Content-Type was not ‘application/json’。 代码如下&#xff1a; # Flask_RESTFUl数据解析 f…

【微服务】接口幂等性常用解决方案

一、前言 在微服务开发中&#xff0c;接口幂等性问题是一个常见却容易被忽视的问题&#xff0c;同时对于微服务架构设计来讲&#xff0c;好的幂等性设计方案可以让程序更好的应对一些高并发场景下的数据一致性问题。 二、幂等性介绍 2.1 什么是幂等性 通常我们说的幂等性&…

Springboot+vue的企业质量管理系统(有报告)。Javaee项目,springboot vue前后端分离项目。

演示视频&#xff1a; Springbootvue的企业质量管理系统&#xff08;有报告&#xff09;。Javaee项目&#xff0c;springboot vue前后端分离项目。 项目介绍&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09…