Visual explanation of MySQL joins: Difference between revisions

Jump to navigation Jump to search
m
Text replacement - "http://planetoid.info/images/" to "https://planetoid.info/images/"
m (Text replacement - "http://planetoid.info/images/" to "https://planetoid.info/images/")
Tags: Mobile edit Mobile web edit
 
Line 63: Line 63:
{{exclaim}} 如果 a 資料比 b 資料的資料筆數少,將會以 a 資料筆數為主,部分 b 資料會遺失。
{{exclaim}} 如果 a 資料比 b 資料的資料筆數少,將會以 a 資料筆數為主,部分 b 資料會遺失。


http://planetoid.info/images/Venn_diagrams_proposition_a.png
https://planetoid.info/images/Venn_diagrams_proposition_a.png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Line 86: Line 86:


== 狀況 1-2: 以 b 資料為主,再把 a 資料黏上 ==
== 狀況 1-2: 以 b 資料為主,再把 a 資料黏上 ==
http://planetoid.info/images/Venn_diagrams_proposition_b.png
https://planetoid.info/images/Venn_diagrams_proposition_b.png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Line 109: Line 109:


== 狀況 2: 交集的資料,同時存在於 a 和 b ==
== 狀況 2: 交集的資料,同時存在於 a 和 b ==
http://planetoid.info/images/Venn_diagrams_intersection_of_two_sets.png
https://planetoid.info/images/Venn_diagrams_intersection_of_two_sets.png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Line 137: Line 137:
存在於資料表 table_a ,但是不存在於 table_b
存在於資料表 table_a ,但是不存在於 table_b


http://planetoid.info/images/Venn_diagrams_relative_complement_of_b_(right)_in_a_(left).png
https://planetoid.info/images/Venn_diagrams_relative_complement_of_b_(right)_in_a_(left).png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Line 155: Line 155:
存在於資料表 table_b ,但是不存在於 table_a
存在於資料表 table_b ,但是不存在於 table_a


http://planetoid.info/images/Venn_diagrams_relative_complement_of_a_(left)_in_b_(right).png
https://planetoid.info/images/Venn_diagrams_relative_complement_of_a_(left)_in_b_(right).png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Line 172: Line 172:


== 狀況 4: 聯集的資料,a 和 b 的所有資料 ==
== 狀況 4: 聯集的資料,a 和 b 的所有資料 ==
http://planetoid.info/images/Venn_diagrams_union_of_two_sets.png
https://planetoid.info/images/Venn_diagrams_union_of_two_sets.png


MySQL 資料庫查詢 (相當於 SQL 的 FULL OUTER JOIN):
MySQL 資料庫查詢 (相當於 SQL 的 FULL OUTER JOIN):
Line 200: Line 200:
對稱差集 (Symmetric difference) 或稱 [https://zh.wikipedia.org/zh-tw/%E9%80%BB%E8%BE%91%E5%BC%82%E6%88%96 邏輯異或] (exclusive or) 的資料,只存在於 table_a 或 table_b 其中一個
對稱差集 (Symmetric difference) 或稱 [https://zh.wikipedia.org/zh-tw/%E9%80%BB%E8%BE%91%E5%BC%82%E6%88%96 邏輯異或] (exclusive or) 的資料,只存在於 table_a 或 table_b 其中一個


http://planetoid.info/images/Venn_diagrams_symmetric_difference_of_two.png
https://planetoid.info/images/Venn_diagrams_symmetric_difference_of_two.png


MySQL 資料庫查詢:
MySQL 資料庫查詢:
Anonymous user

Navigation menu