Another short focus on SQL joins

Needless to say joins are a key feature in SQL as they considerably ease the processing of combining sets together. There already had been one article published on this blog about this topic and so far, developers keep asking what is the difference between a inner join and a left outer join, why isn’t there an inner left join etc.

OUTER JOINS

Unlike the inner join, there are several types of outer joins. An outer join is saying: "From a reference set, join a foreign set if the condition is true". There are two important words in the last sentence: "reference" and "if". Even if the condition is false, the resulting set has all the rows of the reference set. There must be a way to tell the interpreter which set is the reference, here are LEFT, RIGHT & FULL. LEFT means the reference table is the one the join is made on. RIGHT means the reference table is the joined table:

Copyright Grégoire HUBERT 2014 - 2015. All contents on this site are under the CC by-sa licence.CSS nicely adapted by Mikael Paris.Free tools for a free network. This site has been made and is powered using open source and free softwares only.