当前位置:网站首页>一张图看懂 SQL 的各种 join 用法!
一张图看懂 SQL 的各种 join 用法!
2022-08-05 10:26:00 【TimeFriends】
文章目录
下图展示了 LEFT JOIN、RIGHT JOIN、INNER JOIN、OUTER JOIN 相关的 7 种用法。
具体分解如下:
1.INNER JOIN(内连接)
SELECT <select_list>
FROM Table_A A
INNER JOIN Table_B B
ON A.Key = B.Key
2.LEFT JOIN(左连接)
SELECT <select_list>
FROM Table_A A
LEFT JOIN Table_B B
ON A.Key = B.Key
3.RIGHT JOIN(右连接)
SELECT <select_list>
FROM Table_A A
RIGHT JOIN Table_B B
ON A.Key = B.Key
4.OUTER JOIN(外连接)
SELECT <select_list>
FROM Table_A A
FULL OUTER JOIN Table_B B
ON A.Key = B.Key
5.LEFT JOIN EXCLUDING INNER JOIN(左连接-内连接)
SELECT <select_list>
FROM Table_A A
LEFT JOIN Table_B B
ON A.Key = B.Key
WHERE B.Key IS NULL
6.RIGHT JOIN EXCLUDING INNER JOIN(右连接-内连接)
SELECT <select_list>
FROM Table_A A
RIGHT JOIN Table_B B
ON A.Key = B.Key
WHERE A.Key IS NULL
7.OUTER JOIN EXCLUDING INNER JOIN(外连接-内连接)
SELECT <select_list>
FROM Table_A A
FULL OUTER JOIN Table_B B
ON A.Key = B.Key
WHERE A.Key IS NULL OR B.Key IS NULL
关于join,你学废了么?
真诚地邀请您加入我们的大家庭.
在这里不仅有技术知识分享,还有博主们之间的互帮互助
不定期发红包,每月更有抽奖环节,游戏机和实体书相赠(包邮)
让我们抱团取暖,抱团内卷.打造美好C站.期待您的加入.
备注 : CSDN-xxxxxx (xxxxxx代表你csdn的昵称)
边栏推荐
- Common operations of oracle under linux and daily accumulation of knowledge points (functions, timed tasks)
- linux下oracle常见操作以及日常积累知识点(函数、定时任务)
- PHP 操作mangoDb
- What is SPL?
- MySQL data view
- 【综合类型第 35 篇】程序员的七夕浪漫时刻
- Technical dry goods | Hausdorff distance for image segmentation based on MindSpore
- 气象数据数据处理实例——matlab字符串切割匹配与R语言日期匹配(数据拼接)
- MySQL事务
- 项目成本控制如何帮助项目成功?
猜你喜欢
Ali's new launch: Microservices Assault Manual, all operations are written out in PDF
012年通过修补_sss_提高扩散模型效率
如何选币与确定对应策略研究
PCB layout must know: teach you to correctly lay out the circuit board of the op amp
The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?
Our Web3 Entrepreneurship Project, Yellow
Data Middle Office Construction (10): Data Security Management
STM32+ULN2003驱动28BYJ4步进电机(根据圈数正转、反转)
字节一面:TCP 和 UDP 可以使用同一个端口吗?
IDEA performs the Test operation, resulting in duplicate data when data is inserted
随机推荐
第六章:activiti流程分流判断之排它网关和并行网关
PCB layout must know: teach you to correctly lay out the circuit board of the op amp
Still looking for a network backup resources?Hurry up to collect the following network backup resource search artifact it is worth collecting!
IDEA performs the Test operation, resulting in duplicate data when data is inserted
七夕来袭!还要做CDH数据迁移怎么办?来看看DistCp
nyoj86 找球号(一) set容器和二分 两种解法
Where is your most secretive personality?
three objects are arranged in a spherical shape around the circumference
PCB布局必知必会:教你正确地布设运算放大器的电路板
three.js调试工具dat.gui使用
PHP operation mangoDb
SMB + SMB2: Accessing shares return an error after prolonged idle period
第五章:activiti流程分流判断,判断走不同的任务节点
第四章:activiti RuntimeService设置获和取流程变量,及与taskService的区别,开始和完成任务时设置流程变量[通俗易懂]
The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?
2022 Huashu Cup Mathematical Modeling Ideas Analysis and Exchange
SQL Outer Join Intersection, Union, Difference Query
High-quality DeFi application building guide to help developers enjoy DeFi Summer
首次去中心化抢劫?近2亿美元损失:跨链桥Nomad 被攻击事件分析
60行从零开始自己动手写FutureTask是什么体验?