Hi
I want to know the difference between the use of Inner Join and Left Join in a SQL Statement
thanks
Printable View
Hi
I want to know the difference between the use of Inner Join and Left Join in a SQL Statement
thanks
You can read the FAQ - it should be in there
Inner Join:
Bring only records that exist in both the left table and right table.
Left join:
Bring all records in the left table and only those that match from the right table. (uses null for those none matched)
There's also good examples on wikipedia on all type of joins
http://en.wikipedia.org/wiki/Join_(SQL)
This might be worth taking a look at.
Real world...
We use LEFT JOIN 99% of the time.
Although referential integrity should allow INNER JOIN since both sides should almost always exist, since we have legacy data converted from mainframes we would not want to lose the "FROM" table data simply because the "LEFT JOIN" table does not offer up a matching row.