
In this post, we will understand the difference between left outer join, right outer join, and full outer join.
Left Outer Join
It fetches all the rows from the table on the left.
It is same as ‘Inner Join + all the unmatched rows from the left table’.
The data that isn’t matched on the right table is lost.
Example:
SELECT [column_1, column_2, ….]FROM table_1LEFT OUTER JOIN table_2 ONtable_1.matching_column = table_2.matching_column
Right Outer Join
It fetches all the rows of the table on the right.
It is similar to performing ‘Inner Join + all of the unmatched rows from the right table’.
魔乐社区
天翼云和华为联合打造的AI开发者社区,支持AI模型评测训练、全流程开发应用
102 查看详情
The unmatched data from the left table is lost.
Example:
SELECT [column_1, column_2, ….]FROM table_1RIGHT OUTER JOIN table_2 ONtable_1.matching_column = table_2.matching_column
全外连接
它从两个表中获取所有的行。
它类似于执行“内连接 + 左表中所有不匹配的行 + 右表中所有不匹配的行”。
在此操作中不会丢失任何数据。
示例:
SELECT [column_1, column_2, ….]FROM table_1FULL OUTER JOIN table_2 ONtable_1.matching_column = table_2.matching_column
以上就是左、右和完全外连接之间的区别的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/326346.html
微信扫一扫
支付宝扫一扫