The following image can be found by searching for SQL join on the internet:
Can we interpret this as a Venn diagram, in the following way?
- The circle labelled Table A is the set of records in Table A
- The circle labelled Table B is the set of records in Table B
- The intersection of the sets represents inner join (aka just join in SQL)
Motivation
The diagram shown, which appears in various forms widely on the net, looks awfully like a Venn diagram. So the first intuition is to think of it as a Venn diagram. However, one might get stuck trying to define the contents of the sets "Table A" and "Table B".
There is also information on the internet that appears to conflict. This question hopes to help resolve some of the conflicts that arise. Some sites argue that we shouldn't use Venn diagrams for explaining joins:
- https://towardsdatascience.com/can-we-stop-with-the-sql-joins-venn-diagrams-insanity-16791d9250c3
- https://blog.jooq.org/2016/07/05/say-no-to-venn-diagrams-when-explaining-joins/
While there is other information that uses Venn diagrams between tables A and B to explain joins on those tables e.g.