当前位置:网站首页>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
边栏推荐
- 从房产中介到程序员--80后张江男
- ArcEngine(九)图形绘制
- 面试攻略系列(二)-- 秒杀系统
- Spark GC日志分析
- Record the system calls and C library functions used in this project-2
- Come and throw eggs.
- Process/Thread related in Sandbox - 1
- ArcEngine(十)创建矢量图层
- The sword refers to Offer 57 - II. and is a continuous positive sequence of s (sliding window)
- tkiner组件之滚动文本框(scrolledtext )相关操作
猜你喜欢
蓝桥历届真题-蛇形填数
现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
tkiner组件之滚动文本框(scrolledtext )相关操作
【瑞吉外卖】day05:增、删、改、查分类以及公共字段自动填充
记一次 ERROR scheduler.AsyncEventQueue: Dropping event from queue shared导致OOM
禁止输入(×),按键精灵小程序,快速上手
面试攻略系列(二)-- 秒杀系统
gin's middleware and routing grouping
Map mixed density function and quantile added line
远程控制软件-向日葵
随机推荐
学习opencv-基础应用
NC61 两数之和
NC7 买卖股票的最好时机(一)
RobotFramework 之 用户关键字
RobotFramework 之 Setup和Teardown
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
禁止输入(×),按键精灵小程序,快速上手
NC84 完全二叉树结点数
Process/Thread Related in Sandbox - 2
JZ7 重建二叉树
现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
Q_06_02 类型模型
常用函数
RobotFramework 之 Evaluate
处理JSON,fastjson、json-lib简单使用
【瑞吉外卖】day05:增、删、改、查分类以及公共字段自动填充
javscript基础易错点集合
Q_04_05 使用Qubits
IDEA Gradle 常遇问题(二)(持续更新)
Time series analysis course lab report