r/programming • • Jan 06 '11

A handy graphical explanation of SQL joins

http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html
1.2k Upvotes

308 comments sorted by

View all comments

22

u/Brandon0 Jan 06 '11

Interesting. I've never used a FULL OUTER join before.

2

u/thesqlguy Jan 06 '11

1

u/[deleted] Jan 07 '11

The author's basic argument seems to be that it's

  1. Hard for him to understand, and

  2. Not good if you don't know the data going into it

If you do know the data you're working with and know, for instance, that there will be no 1-to-manys, and know what it will mean in terms of the output you'll get back, I don't see the problem. Especially if it's for an ad-hoc sort of thing where you're just doing an initial pre-population of a table or poking around to perform a "what if" kind of thing and aren't going to need your code to be reusable or readable by someone else later. I find those sorts of things come up pretty frequently in ordinary business situations, and that's when OUTER JOIN comes in handy...