views:

50

answers:

2

I am probably going to get slaughtered for this, and told to read the manual (which I have, but it has not helped my understanding).

I working with MySQL more and more at the moment, but I cannot get my head around joins, I know there are multiple types of join, i.e Inner, Outer, Left, Right but I do not what the differences are between them or what the adavantages of using one over the other is.

I find myself more and more just using left joins as I know the syntax, however I am now worried that maybe this good put my applications at a disadvantage in terms of speed and maybe I should be using other joins depending on what my needs are?

+3  A: 

I love this post !!!

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

its a visual explanation (by diagrams) make it pretty clear.

Haim Evgi
Nice post, but why on earth does she jump through `LEFT OUTER JOIN` s in the middle of doing `FULL OUTER JOIN` s? I (roughly) know what I'm doing with MySQL, and that still threw me when she suddenly jumped back... (Note to Asker - basically the last diagram is talking about the same join as the 2nd, not as the 3rd or 4th.)
Stephen
A: 

I really like this explanation: http://beta.codeproject.com/KB/database/Visual_SQL_Joins.aspx?msg=3163619 It shows all kinds of JOIN's and has a nice overview. Make a hardcopy and glue it on your door.

Frank Heikens