For example, consider the diagram below:
CROSS JOIN
When we want to join two or more tables by crossing. That is, for each row of the FUNCIO table we want all POSITIONS or vice versa.
INNER JOIN
When we want to join two or more tables by coincidence. For each row of the FUNCINARIO table we want the corresponding CARGO that internally (INNER), in its attribute values, matches. In the case of FUNCTIONARY and POSITION the coincident internal attributes are codeCargo in the CARGO table and codeCargo in the FUNCIO table. To make effective the joining of the two tables it will be necessary to connect (ON) the two tables by their internal attributes (INNER) coincident.
LEFT OUTER JOIN
Observing the FUNCTIO table, suppose that the Tadeu employee does not have a position associated with it. If we wish to list all employees with their respective positions, including employees without posts, we could use all the power of the INNER JOIN joining by adding OUTER(EXTERNAL/OTHER) Employees who are not part of INNER JOIN, precisely to those without posts, as Tadeu. We can achieve this with the FUNCIO/CARGO junction through the FUNCIONARIO OUTER LEFT JOIN CARGO statement, which promotes the internal joining (INNER) of all employees to positions and lists still others (EXTERNAL/OUTER) not associated.
An important observation is that the link order (ON) makes no difference, ie:
"ON (F.codCargo = C.codCargo)" is exactly equal to "ON (C.codCargo = F.codCargo)"
RIGHT OUTER JOIN
Observing the POSITION table suppose that the MANAGER position, with C3 code, is not referenced/associated by/to any employee in the FUNCTIO table. If we wish to list all POSITIONS and their respective EMPLOYEES, including POSITIONS WITHOUT EMPLOYEES, we could use the RIGTH OUTER JOIN.
OUTER FULL JOIN
Here we gather the power of the internal (JOIN) junctions (INNER), the listing of all other non-associated lines, both on the right side (RIGHT) of the junction and on the LEFT side (LEFT).
@reference
http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
– Paulo Costa
Look here: http://stackoverflow.com/questions/448023/what-is-the-difference-between-left-right-outer-and-inner-joins and here: http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
– Ivan Ferrer
Possible duplicate http://answall.com/questions/99874/comort-select-em-3-tabelas/99876#Answer-99877
– Pedro Camara Junior