当前位置:网站首页>Mysql的七种连接查询方法
Mysql的七种连接查询方法
2022-08-09 13:12:00 【牧歌ing】
Mysql的七种join查询方法

为了大家使用方便代码单独拿出来
左连接 查a表独有和b表共有部分
select * from a left join b on a.key=b.key;
右连接 查b表独有和a表共有部分
select * from a right join b on a.key=b.key;
内连接 查a、b共有部分
select * from a inner join b on a.key=b.key;
只查a独有的部分
select * from a left join b on a.key=b.key where b.key is null;
只查b独有的部分
select * from a right join b on a.key=b.key where a.key is null;
全连接
select * from a left join b on a.key=b.key union select * from a right join b on a.key=b.key;
查a、b共有的部分
select * from a left join b on a.key=b.key where b.key is null union select * from a right join b on a.key=b.key where a.key is null;
oracle 中的全连接和查a、b共有部分
select * from a full outer join b on a.key=b.key
select * from a full outer join b on a.key=b.key where a.key is null or b.key is null
边栏推荐
猜你喜欢
随机推荐
缓存和数据库一致性问题
TCP三次握手和四次挥手及拥塞控制
搭建大型分布式服务(四)Docker搭建开发环境安装Mysql
Q_06_03 表达式
JS轮播图实现
pytest 基础认知
FFMPEG multimedia file processing (deletion and renaming of ffmpeg files)
Q_04_05 使用Qubits
激光器如何养护才能远离结露没烦恼
FFmpeg multimedia file processing (ffmpeg prints audio and video Meta information)
RobotFramework 之 RF变量与标准库关键字使用
海康设备获取YV12图像-不用rtsp
The sword refers to Offer 57 - II. and is a continuous positive sequence of s (sliding window)
问题系列-如何修改或更新localhost里的值
将 .json 格式 转换成 .xml格式
pyautogui的简单操作(2)-弹窗操作
GIN a preliminary study, the environment is installed
Spark GC日志分析
offset、client、scroll、window.pageYOffset比较
The sword refers to Offer 56 - II. Number of occurrences of a number in an array II (bit operation)









