初学SQL之left_join

join用于将多个表的数据组合显示。

The result of a left outer join (or simply left join) for tables A and B always contains all rows of the "left" table (A), even if the join-condition does not find any matching row in the "right" table (B). This means that if the ON clause matches 0 (zero) rows in B (for a given row in A), the join will still return a row in the result (for that row)—but with NULL in each column from B.

left_join是以左表为主表,join的表是为了配合左表,查不到的部分在左表中就显示为null。

215px-SQL_Join_-_01_A_Left_Join_B.svg.png

参考:
https://coolshell.cn/articles/3463.html
https://en.wikipedia.org/wiki/Join_(SQL)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容