当前位置: 首页 > news >正文

多表查询综合归纳

目录

1. 多表关系

1.1 一对多(多对一)

1.2 多对多

 1.3 一对一

2. 多表查询概述

2.1 熟悉表

2.2 笛卡尔积

2.3 消除笛卡尔积

2.4 多表查询分类

3. 内连接

3.1 隐式内连接

3.2 显式内连接

4. 外连接

4.1 左外连接

4.2 右外连接

5. 自连接

5.1 自连接查询 

5.2 外连接查询

6. 联合查询

6.1 union all 

6.2 union

6.3 使用联合查询条件

7. 嵌套/子查询

7.1 标量子查询

7.2 列子查询

1) in 的使用

2)all 的使用

3) any 的使用

7.3 行子查询

7.4 表子查询

8. 多表查询案例

9. 总结

9.1 多表关系

 9.2 多比查询

​编辑

 10 源代码(复制自取)


1. 多表关系

1.1 一对多(多对一)

1.2 多对多

 1.3 一对一

2. 多表查询概述

 

2.1 熟悉表

在接下来的学习中,我们暂且需要使用这两张表,因此,十分有必要熟悉表的结构及其内容;

1. 员工表

2. 部门表

2.2 笛卡尔积

2.3 消除笛卡尔积

在上述多表查询中,可以查到这样的元组。

 显然,有许多信息是我们不需要的,接下来就需要过滤信息,消除笛卡尔积;

2.4 多表查询分类

3. 内连接

内连接又分为隐式内连接和显示内连接;

3.1 隐式内连接

先执行 from ,因此表取别名后,仅允许使用表名;

3.2 显式内连接

显示内连接中, innet 常省略不写;

4. 外连接

外连接分为左外连接和右外连接

此外,左外连接可以改为右外连接,右外连接可以改为左外连接;

4.1 左外连接

左外连接中,out 通常省略;

4.2 右外连接

5. 自连接

5.1 自连接查询 

其使用如下案例所示:

5.2 外连接查询

6. 联合查询

6.1 union all 

这是薪资低于 5000 的员工信息

这是年龄大于 50 的员工信息

这是将两个条件的查询结果联合起来的表

6.2 union

union 可以去除重复;

6.3 使用联合查询条件

7. 嵌套/子查询

7.1 标量子查询

7.2 列子查询

 

1) in 的使用

下面举例演示:

2)all 的使用

 

 

3) any 的使用

7.3 行子查询

7.4 表子查询

再看第二个例子;

8. 多表查询案例

注意:以下查询并非只有一种方式;

 1. 查询员工的姓名,年龄,职位,部门信息;

 2. 查询年龄小于30岁的员工的姓名,年龄,职位,部门信息;

3. 查询拥有员工的部门ID,部门名称(6号部门没有员工)

 4. 查询所有年龄大于40岁的员工,及其所属部门名称,如果员工没有分配部门,也需要展示出来;

 5. 查询所有员工的工资等级

 6. 查询研发部所有员工的信息及工资等级; 

 7. 查询“研发部“员工的平均工资

 8. 查询工资比”灭绝“高的员工信息

 9. 查询比平均工资高的员工信息

 10. 查询低于本部门平均工资的员工信息

 11. 查询所有部门信息,并统计部门员工人数

9. 总结
9.1 多表关系

 9.2 多表查询

 此外,较惋惜的是,本篇未涉及 having,group by ,order by 的使用以及SQL 语句的执行顺序;

 10 源代码(复制自取)
--创建数据库
create database mul_table_demo;--使用数据库
use mul_table_demo;--创建表 department
create table department(de_id smallint primary key,  --部门idde_name varchar(20)			 --部门名称
);--插入表 department
insert into department values(1,'研发部'),(2,'市场部'),(3,'财务部'),(4,'销售部'),(5,'总经办'),(6,'人事部');--创建表 employee
create table employee (em_id smallint primary key,                  --员工IDem_name varchar(20),						 --员工名字age smallint check (age between 18 and 65),  --年龄job varchar(20),							 --工作salary int not null,						 --薪水entrydate date,								 --入职日期manager_id smallint,						 --员工的领导IDdept_id smallint foreign key references department(de_id)--部门ID 
);--插入表 employee
insert into employee values								--在将 varchar 值 '*' 转换成数据类型 int 时失败。表示数据类型弄错了
(1, '金庸',  65,'总裁'    ,20000,'2000-01-01',null, 5), --外键插入的值必须是另一个表的主键的值,即取值范围有限制。因此没有 唯一性限制  
(2, '张无忌',20,'项目经理',12500,'2005-12-05',1, 1),
(3, '杨逍',  33,'开发'    ,8400,' 2000-11-03',2, 1),
(4, '韦一笑',48,'开发'    ,11000,'2002-02-05',2, 1),
(5, '常遇春',43,'开发'    ,10500,'2004-09-07',3, 1),
(6, '小昭',  19,'程序员'  ,6600, '2004-10-12',2, 1),
(7, '灭绝',  60,'财务总监',8500, '2002-09-12',1, 3),
(8, '周芷若',19,'会计'    ,4800, '2006-06-02',7, 3),
(9, '丁敏君',23,'出纳'    ,5250, '2009-05-13',7, 3),
(10,'赵敏',  20,'市场部总监',12500,'2004-10-12',1,2),
(11,'鹿仗客',56,'职员'    ,3750, '2006-10-03',10,2),
(12,'鹤笔翁',19,'职员',    3750, '2007-05-09',10,2),
(13,'方东白',19,'职员'    ,5500, '2000-01-01',10,2),
(14,'张三丰',65,'销售总监',14000,'2009-02-12',1, 4),
(15,'俞莲舟',38,'销售',    4600, '2004-10-12',14,4),
(16,'宋远桥',40,'销售',    4600, '2004-10-12',14,'4'),	-- 4 or '4':加引号不加引号都是可以的;
(17,'陈友谅',42,null,    2000, '2010-01-01',1, null);	--null不属于任何数据类型,因此外键可以插入 null ,char/int 数据类型都可以插入 null--多表查询:笛卡尔积
select * from employee,department;--消除笛卡尔积
select * from employee,department where employee.dept_id = department.de_id;--内连接
--隐式内连接
--查询每个员工的姓名及关联的部门名称
select em.em_name as '员工姓名',de.de_name as '部门名称' 
from employee as em ,department as de 
where em.dept_id = de.de_id;--显式内连接
--查询每个员工的姓名及关联的部门名称
select em.em_name,de.de_name 
from employee as em 
join department as de
on em.dept_id = de.de_id--外连接
--左外连接
--查询 emp 表的全部数据及对应的部门信息
select em.*,de.de_name
from employee as em 
left join department as de 
on em.dept_id = de.de_id--右外连接
--查询 dept 表的所有信息,和对应的员工信息
select de.de_id,de.de_name,em.* 
from employee as em 
right join department as de
on em.dept_id = de.de_id--自连接
select * from employee;
--查询员工及其领导的名字
select b.em_name as '员工姓名', a.em_name as '领导姓名' 
from employee as a,employee as b
where a.em_id = b.manager_id;--查询所有员工及其领导的名字,如果员工没有领导,也要查询出来
select * from employee;
selectb.em_name  as '员工姓名' ,a.em_name  as '领导姓名'
from employee as a 
right join employee as b
on a.em_id = b.manager_id; --联合查询
--查询薪资低于 5000 或年龄大于 50 岁的员工的信息(union all)select * from employee as e where e.salary < 5000
union all
select * from employee as e where e.age > 50--查询薪资低于 5000 或年龄大于 50 岁的员工的信息(union)
select * from employee as e where e.salary < 5000
union 
select * from employee as e where e.age > 50select * from employee as e where e.salary < 5000 or e.age > 50;--子查询
--标量子查询
--查询“销售部”所在员工的全部信息--1. 查询“销售部”部门ID
select de_id from department as de where de.de_name ='销售部';
--2. 根据部门ID,查询“员工表”员工信息
select * from employee as em where em.dept_id = 4;
--使用子/嵌套查询,将上述结果整合起来
select * from employee as em 
where em.dept_id = (select de.de_id from department as de where de.de_name ='销售部'
);--查询“方东白”入职之后的员工信息
--方东白的入职日期
select e.entrydate from employee as e where e.em_name='方东白';
--根据方东白的入职日期,查询员工信息
select * from employee as em where em.entrydate > '2000-01-01';
----使用子/嵌套查询,将上述结果整合起来
select * from employee as em where em.entrydate > (select e.entrydate from employee as e where e.em_name='方东白');--列子查询
--查询“销售部”和“市场部”的员工信息
--1. 查询“销售部”和“市场部”的部门ID
select de.de_id from department as de where de.de_name in ('销售部','市场部'); 
--2. 查询根据“销售部”和“市场部”的部门ID,查询其员工信息
select * from employee as em where em.dept_id in (2,4);
--使用子/嵌套查询,将上述结果整合起来
select * from employee as em where em.dept_id in (select de.de_id from department as de where de.de_name in ('销售部','市场部')
);--查询比财务部所有人员工资都高的员工信息
--1. 查询财务部的人员工资
select e.salary 
from employee as e 
where e.dept_id in (select d.de_id from department as d where d.de_name = '财务部');
--2. 根据财务部的人员工资,查询比其工资都高的员工信息
select * from employee as e where e.salary > 8500;
--使用子/嵌套查询,将上述结果整合起来(all)
select * from employee as e where e.salary > all(select e.salary from employee as e where e.dept_id in (select d.de_id from department as d where d.de_name = '财务部')
);--查询比研发部其中任意一人工资高的员工信息
--1. 查询研发部人员的工资
select e.salary 
from employee as e 
where e.dept_id in (select d.de_id from department as d where d.de_name = '研发部'); 
--2.查询比其任意一人工资高的员工信息
select * from employee as e where e.salary > 6600;
----使用子/嵌套查询,将上述结果整合起来( any)
select * from employee as e where e.salary > any (select e.salary from employee as e where e.dept_id in (select d.de_id from department as d where d.de_name = '研发部')
);--行子查询
--查询 张无忌的薪资及直属领导相同 的员工信息
--1.查询张无忌的薪资
select e.salary,e.manager_id from employee as e where e.em_name = '张无忌';
--2.根据查询结果,查询员工信息
select * from employee as e where e.salary = 12500 and e.manager_id = 1;
--使用子/嵌套查询,将上述结果整合起来
select * from employee as e where (e.salary,e.manager_id) =(select e.salary,e.manager_id from employee as e where e.em_name = '张无忌');--表子查询
--查询“鹿仗客”,“宋远桥”的职位和薪资相同的员工信息
select * from employee as e where (e.salary,e.job) in (select e.salary,e.job from employee as e where e.em_name in ('鹿仗客','宋远桥'));--查询入职日期是“2006-01-01”之后的员工信息,及其部门信息
select e.*,d.* 
from ( select * from employee as e where e.entrydate > '2006-01-01') as e ,department as d
wheree.dept_id = d.de_id;--案例巩固
select * from employee;
select * from department;
select * from salgrade;
--在创建一张表
create table salgrade(grade int,			--薪资等级losal int,			--最低薪资hisal int			--最高薪资
)
insert into salgrade values(1,0,3000),(2,3001,5000),(3,5001,8000),(4,8001,10000),(5,10001,15000),(6,15001,20000),(7,20001,25000),(8,25001,3000);--1. 查询员工的姓名,年龄,职位,部门信息;
select e.em_name,e.age,e.job,d.de_name 
from employee as e 
left join department as d 
on e.dept_id = d.de_id ; 
--2. 查询年龄小于30岁的员工的姓名,年龄,职位,部门信息
select e.em_name,e.age,e.job,d.de_name 
from employee as e 
left join department as d 
on e.dept_id = d.de_id 
where e.age < 30;--3. 查询拥有员工的部门ID,部门名称(6号部门没有员工)
--方法1:子查询
select distinctd.de_id,d.de_name 
from (select e.dept_id from employee as e) as em ,department as d
where em.dept_id = d.de_id;
--方法2:内连接
select distinctd.de_id,d.de_name 
from employee as e,department as d 
where e.dept_id = d.de_id; --4. 查询所有年龄大于40岁的员工,及其所属部门名称,如果员工没有分配部门,也需要展示出来;
select e.*,d.de_name 
from	employee as e 
left join department as d 
on e.dept_id = d.de_id 
where e.age > 40; --5. 查询所有员工的工资等级(薪水等级表没有外键,如何连接表是关键)
select * 
from employee as e ,salgrade as s 
where e.salary between s.losal and s.hisal; --6. 查询研发部所有员工的信息及工资等级
select e.*,s.grade 
from (select * from employee as e join department as d on e.dept_id = d.de_id where d.de_name = '研发部') as e ,salgrade as s 
where e.salary between s.losal and s.hisal;--7. 查询“研发部“员工的平均工资
select avg(e.salary)
from employee as e 
join department as d 
on e.dept_id = d.de_id 
whered.de_name = '研发部'--8. 查询工资比”灭绝“高的员工信息
select * from 
employee as e 
where e.salary > ( select e.salary from employee as e where e.em_name = '灭绝');--9. 查询比平均工资高的员工信息
select * from 
employee as e 
where e.salary > ( select avg(salary) from employee);--10. 查询低于本部门平均工资的员工信息
select e2.*,(select avg(e1.salary) from employee as e1 where e1.dept_id = e2.dept_id ) as '平均' 
from employee as e2 
where e2.salary < (select avg(e1.salary) from employee as e1 where e1.dept_id = e2.dept_id ) ;--11. 查询所有部门信息,并统计部门员工人数
select count(*) from employee as e where e.dept_id = 6;
select d.de_id,d.de_name,(select count(*) from employee as e where e.dept_id = d.de_id) as '人数' 
from department as d;

相关文章:

多表查询综合归纳

目录 1. 多表关系 1.1 一对多&#xff08;多对一&#xff09; 1.2 多对多 1.3 一对一 2. 多表查询概述 2.1 熟悉表 2.2 笛卡尔积 2.3 消除笛卡尔积 2.4 多表查询分类 3. 内连接 3.1 隐式内连接 3.2 显式内连接 4. 外连接 4.1 左外连接 4.2 右外连接 5. 自连接 …...

【5.线性表-链式表示-王道课后算法题】

王道数据结构-第二章-链式表示算法题 1.在带头结点的单链表L中&#xff0c;删除所有值为x的结点&#xff0c;并释放其空间&#xff0c;假设值为x的结点不唯一&#xff0c;试编写算法以实现上述操作。2. 试编写在带头结点的单链表L中删除一个最小值结点的高效算法(假设该结点唯一…...

存储过程及练习

1.存储过程 &#x1f4d6;什么是存储过程&#xff1f; 存储过程和函数是事先经过编译并存储在数据库中的一段sql语句集合&#xff0c;调用存储过程函数可以简 化应用开发人员的很多工作&#xff0c;减少数据在数据库和应用服务器之间的传输&#xff0c;对于提高数据处理的 效率…...

【在Linux世界中追寻伟大的One Piece】多路转接epoll

目录 1 -> I/O多路转接之poll 1.1 -> poll函数接口 1.2 -> poll的优点 1.3 -> poll的缺点 1.4 -> poll示例 1.4.1 -> 使用poll监控标准输入 2 -> I/O多路转接之epoll 2.1 -> 初识epoll 2.2 -> epoll的相关系统调用 2.2.1 -> epoll_cre…...

设计模式-参考的雷丰阳老师直播课

一般开发中使用的模式为模版模式策略模式组合&#xff0c;模版用来定义骨架&#xff0c;策略用来实现细节。 模版模式 策略模式 与模版模式特别像&#xff0c;模版模式会定义好步骤定义好框架&#xff0c;策略模式定义小细节 入口类 使用模版模式策略模式开发支付 以上使用…...

Python +Pyqt5 简单视频爬取学习(一)

文章目录 前言 一、演示 二、查找网页视频流的索引文件 三、分析视频流的url和视频流索引文件的差异性 四、判断视频数据是否需要转化为ts 五、判断视频是否被加密&#xff0c;如若被加密&#xff0c;需要先解密 六、合并所有的ts视频&#xff0c;以MP4模式输出完整视频 总结 前…...

Python Requests模块全面教程

Python Requests模块全面教程 在现代软件开发中&#xff0c;网络请求是一个不可或缺的部分。无论是获取网页数据、调用API接口&#xff0c;还是进行数据交互&#xff0c;都会涉及到HTTP请求。Python的Requests模块是一个非常强大的库&#xff0c;能够让我们轻松地发送HTTP请求…...

PyQt入门指南六十 与Python其他库的集成方法

PyQt是一个强大的GUI库&#xff0c;它可以与Python的其他库无缝集成&#xff0c;以实现更复杂的功能。以下是一些常见的集成方法和示例&#xff1a; 1. NumPy NumPy是Python中用于科学计算的基础库。您可以在PyQt应用程序中使用NumPy来处理数据和进行数值计算。 import sys …...

Android15之解决:Dex checksum does not match for dex:framework.jar问题(二百三十九)

简介&#xff1a; CSDN博客专家、《Android系统多媒体进阶实战》一书作者 新书发布&#xff1a;《Android系统多媒体进阶实战》&#x1f680; 优质专栏&#xff1a; Audio工程师进阶系列【原创干货持续更新中……】&#x1f680; 优质专栏&#xff1a; 多媒体系统工程师系列【…...

车企自动驾驶功能策略 --- 硬件预埋(卷传感器配置)

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 屏蔽力是信息过载时代一个人的特殊竞争力,任何消耗你的人和事,多看一眼都是你的不对。非必要不费力证明自己,无利益不试图说服别人,是精神上的节…...

【已为网站上传证书,却显示不安全】

已为网站上传证书,却显示不安全 错误显示解决办法分析原因 错误显示 此站点有一个由受信任的颁发机构颁发的有效证书但是网站的某些部分不安全 解决办法 删除浏览器所有历史记录, 如果是Edge浏览器显示不安全,那就删除Edge浏览器的所有历史记录; 如果是Google Chrome浏览器显…...

docker busybox作为initContainers

一、上传到私有仓储 docker pull busybox:1.33.1 docker tag busybox:1.33.1 192.168.31.185/public/busybox:1.33.1 docker push 192.168.31.185/public/busybox:1.33.1 --- apiVersion: apps/v1 kind: Deployment metadata:annotations: {}labels: {}name: saas-ali-apiname…...

20.UE5UI预构造,开始菜单

2-22 开始菜单、事件分发器、UI预构造_哔哩哔哩_bilibili 目录 1.UI预构造 2.开始菜单和开始关卡 2.1开始菜单 2.2开始关卡 2.3将开始菜单展示到开始关卡 3.事件分发器 1.UI预构造 如果我们直接再画布上设计我们的按钮&#xff0c;我们需要为每一个按钮进行编辑&#x…...

Electron教程1-初学入门

玩转Electron Electron 是什么注意事项环境安装安装 vscode安装 git 第一个实例第二个实例第二个实例解读 总结问题解答 Electron 是什么 Electron是一个使用 JavaScript、HTML 和 CSS 构建桌面应用程序的框架。 嵌入 Chromium 和 Node.js 到 二进制的 Electron 允许您保持一个…...

从北美火到中国,大数据洞察品牌“STANLEY”的突围之路

保守直筒大头的“硬汉”外形&#xff0c;以百变颜色踩中时尚命脉&#xff0c;与各路大牌“梦幻联动”&#xff0c;不少时尚弄潮儿没能逃过其“真香”诱惑。 这就是今年以来从北美火到中国的STANLEY&#xff0c;在“巨无霸”水杯中突围出属于自己的一条路。 最近STANLEY又整活…...

深度学习之GAN应用

1 GAN的应用&#xff08;文本生成&#xff09; 1.1 GAN为什么不适合文本任务&#xff1f; ​ GAN在2014年被提出之后&#xff0c;在图像生成领域取得了广泛的研究应用。然后在文本领域却一直没有很惊艳的效果。主要在于文本数据是离散数据&#xff0c;而GAN在应用于离散数据时…...

鸿蒙生态下的安全隐私保护:打造用户信任的应用体验

鸿蒙生态下的安全隐私保护&#xff1a;打造用户信任的应用体验 随着华为鸿蒙系统的快速发展&#xff0c;越来越多的设备开始支持这一操作系统&#xff0c;不仅限于智能手机&#xff0c;还包括智能穿戴设备、智能家居产品等。作为开发者&#xff0c;在享受鸿蒙生态系统带来的广…...

用pandoc工具实现ipynb,md,word,pdf之间的转化

Pandoc 是一个强大的工具&#xff0c;可以实现多种文件格式之间的转换&#xff0c;包括 Jupyter Notebook (.ipynb)、Markdown (.md)、Word (.docx)、PDF 等格式。以下是具体的实现方法&#xff1a; 1. 安装 Pandoc 确保已安装 Pandoc&#xff1a; Linux: sudo apt install p…...

第三十一天|贪心算法| 56. 合并区间,738.单调递增的数字 , 968.监控二叉树

目录 56. 合并区间 方法1&#xff1a;fff 看方法2&#xff1a;fff优化版 方法3&#xff1a; 738.单调递增的数字 968.监控二叉树&#xff08;贪心二叉树&#xff09; 56. 合并区间 判断重叠区间问题&#xff0c;与452和435是一个套路 方法1&#xff1a;fff 看方法2&am…...

力扣 最长公共前缀-14

最长公共前缀-14 class Solution { public:string longestCommonPrefix(vector<string>& strs) {//定义一个字符数组&#xff0c;用于存储strs字符串数组第一个字符串&#xff0c;方便与后面的字符串进行比较判断char s[200];//定义一个字符数组&#xff0c;用来返回…...

微信小程序之bind和catch

这两个呢&#xff0c;都是绑定事件用的&#xff0c;具体使用有些小区别。 官方文档&#xff1a; 事件冒泡处理不同 bind&#xff1a;绑定的事件会向上冒泡&#xff0c;即触发当前组件的事件后&#xff0c;还会继续触发父组件的相同事件。例如&#xff0c;有一个子视图绑定了b…...

中南大学无人机智能体的全面评估!BEDI:用于评估无人机上具身智能体的综合性基准测试

作者&#xff1a;Mingning Guo, Mengwei Wu, Jiarun He, Shaoxian Li, Haifeng Li, Chao Tao单位&#xff1a;中南大学地球科学与信息物理学院论文标题&#xff1a;BEDI: A Comprehensive Benchmark for Evaluating Embodied Agents on UAVs论文链接&#xff1a;https://arxiv.…...

Java如何权衡是使用无序的数组还是有序的数组

在 Java 中,选择有序数组还是无序数组取决于具体场景的性能需求与操作特点。以下是关键权衡因素及决策指南: ⚖️ 核心权衡维度 维度有序数组无序数组查询性能二分查找 O(log n) ✅线性扫描 O(n) ❌插入/删除需移位维护顺序 O(n) ❌直接操作尾部 O(1) ✅内存开销与无序数组相…...

P3 QT项目----记事本(3.8)

3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...

Cinnamon修改面板小工具图标

Cinnamon开始菜单-CSDN博客 设置模块都是做好的&#xff0c;比GNOME简单得多&#xff01; 在 applet.js 里增加 const Settings imports.ui.settings;this.settings new Settings.AppletSettings(this, HTYMenusonichy, instance_id); this.settings.bind(menu-icon, menu…...

Neo4j 集群管理:原理、技术与最佳实践深度解析

Neo4j 的集群技术是其企业级高可用性、可扩展性和容错能力的核心。通过深入分析官方文档,本文将系统阐述其集群管理的核心原理、关键技术、实用技巧和行业最佳实践。 Neo4j 的 Causal Clustering 架构提供了一个强大而灵活的基石,用于构建高可用、可扩展且一致的图数据库服务…...

学校时钟系统,标准考场时钟系统,AI亮相2025高考,赛思时钟系统为教育公平筑起“精准防线”

2025年#高考 将在近日拉开帷幕&#xff0c;#AI 监考一度冲上热搜。当AI深度融入高考&#xff0c;#时间同步 不再是辅助功能&#xff0c;而是决定AI监考系统成败的“生命线”。 AI亮相2025高考&#xff0c;40种异常行为0.5秒精准识别 2025年高考即将拉开帷幕&#xff0c;江西、…...

【C++进阶篇】智能指针

C内存管理终极指南&#xff1a;智能指针从入门到源码剖析 一. 智能指针1.1 auto_ptr1.2 unique_ptr1.3 shared_ptr1.4 make_shared 二. 原理三. shared_ptr循环引用问题三. 线程安全问题四. 内存泄漏4.1 什么是内存泄漏4.2 危害4.3 避免内存泄漏 五. 最后 一. 智能指针 智能指…...

【FTP】ftp文件传输会丢包吗?批量几百个文件传输,有一些文件没有传输完整,如何解决?

FTP&#xff08;File Transfer Protocol&#xff09;本身是一个基于 TCP 的协议&#xff0c;理论上不会丢包。但 FTP 文件传输过程中仍可能出现文件不完整、丢失或损坏的情况&#xff0c;主要原因包括&#xff1a; ✅ 一、FTP传输可能“丢包”或文件不完整的原因 原因描述网络…...

【WebSocket】SpringBoot项目中使用WebSocket

1. 导入坐标 如果springboot父工程没有加入websocket的起步依赖&#xff0c;添加它的坐标的时候需要带上版本号。 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId> </dep…...