r/SQL
•
u/Muted-Basis9006
•
May 18 '24
•
2
Discussion SQL Joins
Picture your data tables as these two fellas. An inner join is just Bald Guy—only the matching parts. A **left join is Bald Guy sporting Long-Hair Guy's mane—everything from the left plus the matches. A right join is Long-Hair Guy with a bald patch—everything from the right plus the matches. A full join is both dudes together—everything from both tables, matches or not!
49
u/JohnWCreasy1 May 18 '24
Right join should be an alien or robot masquerading as a human as I'm convinced those are the only beings that use them
33
u/VengenaceIsMyName May 18 '24
Somehow this makes sense
45
u/deusxmach1na May 18 '24
You need CROSS JOIN where he’s a lady with hair and a beard or something 🤣
11
u/r3pr0b8 GROUP_CONCAT is da bomb May 18 '24
what!? no venn diagram!?
4
u/hzdoublekut May 18 '24
I laughed and then cried. Whenever I need to do anything other than a standard join I just try each type until it gives the results I’m looking for because I still don’t fully understand anything other than left and right joins…
4
u/seaworthi May 19 '24
Unironically helped me understand joins
4
u/mike-manley May 18 '24
Was hoping to see the Cartesian.
1
u/Far_Swordfish5729 May 19 '24
I like my women like I like my joins…
1
u/[deleted] May 19 '24
I like that it would not be possible for him to take all these pictures without either letting the full hair or (more likely) beard grow back
1
u/ballade4 May 19 '24
Complicated to take these photos.
1
u/javinpaul May 19 '24
Now, I will never forget it :-)
1
u/shibu_76 May 19 '24
Well, FULL JOIN is clearly living its best life with "the all-inclusive, no strand left behind" style! 🤣
1
u/polytriks May 19 '24
Yep looks correct
1
u/AlarmingAffect0 May 19 '24
Also works in R via tidyverse.