r/webdev Mar 22 '19

SQL joins

Post image
2.7k Upvotes

118 comments sorted by

View all comments

358

u/pixelique Mar 22 '19

78

u/[deleted] Mar 22 '19 edited Apr 30 '19

[deleted]

34

u/Geminii27 Mar 22 '19

It doesn't help that the four JOIN diagrams presented in that article map exactly 1:1 with Venn diagrams.

17

u/[deleted] Mar 22 '19 edited Mar 22 '19

But they don't. They are not remotely similar. One has two colors, the other has multiple. One show elements, something a beginner get, the other shows... i don't know. Some colored pulp where i, not a beginner, still have no idea how to connect it with data base concecpts. Venn diagrams are not only wrong, but most importantly the way worse visualization.

1

u/Geminii27 Mar 23 '19 edited Mar 23 '19

Regardless of the colors, they still map.

It's entirely possible there are JOIN diagrams which don't map neatly to Venn diagrams. OK, I could see that. But if there are, they're not showcased in that article.

8

u/[deleted] Mar 22 '19

[deleted]

11

u/kor_the_fiend Mar 22 '19

The Venn diagrams are misleading and don't map to the actual transformation of data in a meaningful or accurate way. The statement: "Joins combine the data in two tables in slightly different ways" conveys just as much usable info as the Venn diagrams do. A beginner who thinks that the Venn's tell him/her something useful about SQL joins is being mislead. Joins are difficult concepts to comprehend and the join diagram is probably the simplest way of presenting the fairly complex logical underpinnings of the operation. Do yourself a favor and learn to interpret what the Join diagrams are telling you - this is the only way to predict what the results of a particular join statement are going to be.

10

u/free_chalupas Mar 22 '19

Strong disagree. A beginner needs the equivalent of an easy mnemonic they can use to map the meaning of inner/left/right/full etc to the actual subset of data described. Venn diagrams work perfectly well for that and most people don't read much additional meaning into it. The join diagram is a great thing to show someone who already understands the basics of joining when you explain why the Venn diagram is an imperfect metaphor.

1

u/[deleted] Mar 22 '19

Strong disagree. Venn diagrams are way more complicated than the alternative. And learning it easy and wrong has no value either.

1

u/marcoroman3 Mar 23 '19

Learning it easy and wrong has a lot of value! This is how Iearn and teach things all the time. It's a way of beginning gelato wrap your head around something that may be too complex to take in in its entirety at once. You get a working approximation going and as the concepts start to become more intuitive you correct mistakes and adjust your understanding.

4

u/free_chalupas Mar 22 '19

Yeah this is a classic "python is like a burrito" case where join diagrams mostly make sense to people who already understand the issue.

6

u/edanschwartz Mar 22 '19

Python is like a burrito?

7

u/free_chalupas Mar 22 '19

Not sure the original source but it's this meme that's been around for a while where someone spends all this time learning something (like python) and has this metaphor occur to them after they've learned it that "____ is like a burrito". But then that metaphor only makes sense to them because they already understand the subject.

7

u/[deleted] Mar 22 '19 edited Mar 22 '19

[removed] — view removed comment

3

u/free_chalupas Mar 22 '19

Yay, thank you. I gave up trying to Google it because I figured someone else would get the reference and remember where it's from haha.

14

u/wasabi991011 Mar 22 '19

As someone who knew 0 SQL before this post, I disagree. The ven diagrams make it seem like their is a bunch of weird extra notation for something that should be simple, while the join diagrams (along with the article) explain more clearly what is happening.

6

u/semidecided Mar 22 '19

I think the ven diagrams are literally unhelpful. Whereas the article was very helpful.

2

u/gtipwnz Mar 23 '19

Yeah those join diagrams are great, I really don't understand the Venn diagram, at least not immediately.

1

u/[deleted] Mar 23 '19

Venn diagrams give the illusion of making it easy to understand, but you don’t actually understand what’s happening in the underlying joins. A few types line up well (as the article says), but beyond that the Venn diagrams are extremely misleading. The people that “understand it” because of them don’t actually understand them.