0

I'm fairly new to MySQL, and I am not understanding the use of the keywords INNER and OUTER. I understand what they mean, but I don't understand when one would actually enter the keywords in a query. It seems like a JOIN is always an INNER and a LEFT or RIGHT join is always OUTER.

Therefore, what are the cases when one would use the keywords rather than simply writing JOIN (always INNER ?) and LEFT JOIN (always OUTER ?)

JDelage
  • 13,036
  • 23
  • 78
  • 112
  • possible duplicate of [SQL: difference between inner and outer join](http://stackoverflow.com/questions/38549/sql-difference-between-inner-and-outer-join) – ceejayoz Apr 16 '12 at 20:08
  • Nicely explained here : http://stackoverflow.com/questions/38549/sql-difference-between-inner-and-outer-join – WizLiz Apr 16 '12 at 20:08
  • 1
    No - I am not asking for the difference between INNER and OUTER, I am asking in which cases do you use those keywords as opposed to simply writing `JOIN` (always `INNER` ?) and `LEFT JOIN` (always `OUTER` ?). – JDelage Apr 16 '12 at 20:10

3 Answers3

5

There is really no functional reason for the INNER and OUTER keywords to be used, other than for clarity.

Also, not really a duplicate, but the same ground is covered by this question as well:

Do you use the OUTER keyword when writing left/right JOINs in SQL?

Community
  • 1
  • 1
Eric Petroelje
  • 59,820
  • 9
  • 127
  • 177
0

Left outer join will show all elements of the table that is defined first (on the left) plus the elements that satisfy the join condition from the second table (on the right).

If you don't define the type of join, it's considered to be an inner join.

A good explanation is here: http://en.wikipedia.org/wiki/Join_(SQL)

C0D3
  • 6,440
  • 8
  • 43
  • 67
  • Sorry - this is not what I'm asking. – JDelage Apr 16 '12 at 20:11
  • You have to define the join only if it's an outer join. By default, a join is inner join. Apart from using it in a join, I don't know the uses of inner or outer on their own tbh. – C0D3 Apr 16 '12 at 20:14
0

inner is more inside the intersection and outer is "not" intersection, take a look to this link: http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins here they explain the inner and outer, left, right, etc

jcho360
  • 3,724
  • 1
  • 15
  • 24