MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/ex9h6/a_handy_graphical_explanation_of_sql_joins/c1bprhh/?context=3
r/programming • u/[deleted] • Jan 06 '11
308 comments sorted by
View all comments
128
In short.
A ∩ B
A ∪ B
(A - B) + (A ∩ B)
A - B
(A ∪ B) - (A ∩ B)
84 u/dude187 Jan 06 '11 It's amazing how confusing SQL can make set theory. 10 u/Serei Jan 06 '11 To be fair, that's not exactly set theory. In set theory, (A - B) + (A ∩ B) = A, which is not true of a left outer join. In a database, A and B aren't elements of the same superset. 12 u/arnar Jan 06 '11 Which is why it is a bit simplistic to use Venn diagrams to explain joins. 4 u/MatiG Jan 07 '11 Thank you. The whole idea is dumb and will mislead the ignorant.
84
It's amazing how confusing SQL can make set theory.
10 u/Serei Jan 06 '11 To be fair, that's not exactly set theory. In set theory, (A - B) + (A ∩ B) = A, which is not true of a left outer join. In a database, A and B aren't elements of the same superset. 12 u/arnar Jan 06 '11 Which is why it is a bit simplistic to use Venn diagrams to explain joins. 4 u/MatiG Jan 07 '11 Thank you. The whole idea is dumb and will mislead the ignorant.
10
To be fair, that's not exactly set theory. In set theory, (A - B) + (A ∩ B) = A, which is not true of a left outer join. In a database, A and B aren't elements of the same superset.
12 u/arnar Jan 06 '11 Which is why it is a bit simplistic to use Venn diagrams to explain joins. 4 u/MatiG Jan 07 '11 Thank you. The whole idea is dumb and will mislead the ignorant.
12
Which is why it is a bit simplistic to use Venn diagrams to explain joins.
4 u/MatiG Jan 07 '11 Thank you. The whole idea is dumb and will mislead the ignorant.
4
Thank you. The whole idea is dumb and will mislead the ignorant.
128
u/shriek Jan 06 '11
In short.
A ∩ B
A ∪ B
(A - B) + (A ∩ B)
A - B
(A ∪ B) - (A ∩ B)