views:

8979

answers:

4

What is the difference between left join and left outer join?

+18  A: 

Nothing. They are equivalent.

Mitch Wheat
erm hello! who voted this down? LEFT JOIN is teh same as LEFT OUTER JOIN.
Mitch Wheat
Mitch - nothing personal! just that they are not the same.. a LEFT JOIN is an implicit LEFT INNER JOIN
pro
Not in sql server its not, and that's what the poster asked for.
Mitch Wheat
@Peter: No, you're wrong. There's no such thing as a left inner join. The "OUTER" keyword is optional, but LEFT [OUTER] JOIN is always an outer join.
Bill Karwin
There is no such thing as a LEFT INNER JOIN in sql server
Mitch Wheat
This is the case in Microsoft SQL Server, and any other SQL-compliant RDBMS.
Bill Karwin
I figured it applied to them all, but I was definte about SQL Server
Mitch Wheat
apologies - you are quite correct - I've removed my downvote and answerthere is no such thing as a left inner join - I'd have realised that if I'd thought about it a bit more - PS. it's early morning here and that's my excuse
pro
@Peter: no problem.
Mitch Wheat
I like simple answers.
Discodancer
+24  A: 

As per the documentation: FROM (Transact-SQL):

<join_type> ::= 
    [ { INNER | { { LEFT | RIGHT | FULL } [ OUTER ] } } [ <join_hint> ] ]
    JOIN

The keyword OUTER is optional (enclosed in square brackets), so whether you use it or not it makes no difference.

Also note that the entire type-part of the JOIN clause is optional, in which case the default is INNER if you just specify JOIN. In other words, this is legal:

SELECT *
FROM A JOIN B ON A.X = B.Y
Lasse V. Karlsen
Absolutely correct. OUTER is allowed for ANSI-92 compatibility.
Sean Reilly
+1  A: 

Syntactic sugar, makes it more obvious to the casual reader that the join isn't a full one.

Unsliced
So... what's a FULL OUTER JOIN then?
David B
tableA FULL OUTER JOIN tableB will give you three types of records: all records in tableA with no matching record in tableB, all records in tableB with no matching record in tableA, and all records in tableA with a matching record in tableB.
Dave DuPlantis
+1  A: 

Hi guys! I'm a PostgreSQL DBA, as far as i could understand the difference between outer or not outer joins difference is a topic that has considerable discussion all around the internet. Until today i never saw a difference between those two so i went further and i try to find the difference between those. In the end i read the whole documentation about it and i found the answer for this,

So if you look on documentation(at lest PostgreSQL) you can find this phrase:

"The words INNER and OUTER are optional in all forms. INNER is the default; LEFT, RIGHT, and FULL imply an outer join." (http://www.postgresql.org/docs/8.4/static/queries-table-expressions.html)

In another words,

Left Join and Left Outer Join ARE THE SAME

Right Join and Right Outer Join ARE THE SAME

I hope it can be a contribute for those who are still trying to find the answer.

andrefsp