3 ms·
sigh... this is totally wrong... as Jeff himself kinda realized with his comment "There's also a cartesian product or cross join, which as far as I can tell, ca
by quizotic 13y ago
sigh... this is totally wrong... as Jeff himself kinda realized with his comment "There's also a cartesian product or cross join, which as far as I can tell, can't be expressed as a Venn diagram"
SQL does have set operations, and the Venn diagram treatment is much less terrible [though still not quite accurate] at explaining SQL set semantics.
The biggest flaw with the Venn diagram thing is that it doesn't capture the productive aspect of joins.
A inner join B on (some-condition) will produce ALL combinations of A records pasted to B records where some-condition holds.
The Venn diagram approach can't distinguish between a single A-pasted-to-B record and 100 thousand combinations of A-pasted-to-different-Bs. All it can say is that the resulting combinations consist of some set of A and B records.
Venn diagrams don't accurately describe the records resulting from a join at all. At best, they rule out records that can't occur.
So they're not so great as an explanatory device.
- epochwolf 13y agoIt's good enough for a beginner to start with. Provided they know it's not the complete picture.
- quizotic 13y agoReally? Even if it NEVER produces the right answer? How is it useful then? A [inner|left|right|outer|cross|natural|whatever] join B NEVER produces a result that is in either A or B. It produces something larger, that wasn't it A or B before. It's like trying to describe the result of meiosis with a Venn diagram. It's the combinations that matter, and the combinations are not reflected in the Venn diagram.
- gburnett 13y agoIt's not that the picture is incomplete. It is, I believe, that the picture is incorrect. Sets are not relations. This is a barrier to understanding for a beginner.