登录
首页 >  数据库 >  MySQL

左、右和完全外连接之间的区别

来源:tutorialspoint

时间:2023-08-25 21:43:29 123浏览 收藏

各位小伙伴们,大家好呀!看看今天我又给各位带来了什么文章?本文标题《左、右和完全外连接之间的区别》,很明显是关于数据库的文章哈哈哈,其中内容主要会涉及到等等,如果能帮到你,觉得很不错的话,欢迎各位多多点评和分享!

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_1
LEFT OUTER JOIN table_2 ON
table_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’.

The unmatched data from the left table is lost.

Example:

SELECT [column_1, column_2, ….]
FROM table_1
RIGHT OUTER JOIN table_2 ON
table_1.matching_column = table_2.matching_column

全外连接

它从两个表中获取所有的行。

它类似于执行“内连接 + 左表中所有不匹配的行 + 右表中所有不匹配的行”。

在此操作中不会丢失任何数据。

示例:

SELECT [column_1, column_2, ….]
FROM table_1
FULL OUTER JOIN table_2 ON
table_1.matching_column = table_2.matching_column

今天关于《左、右和完全外连接之间的区别》的内容介绍就到此结束,如果有什么疑问或者建议,可以在golang学习网公众号下多多回复交流;文中若有不正之处,也希望回复留言以告知!

声明:本文转载于:tutorialspoint 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>