初學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)

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容