Outer Join: all matching tuples are returned are returned (depending on type)
Left Outer Join (SQL)
Left Outer Join (
LEFT OUTER JOIN): Keeps values from the left table even if they are not matched.SELECT E.name, S.fname FROM ( EMPLOYEE E LEFT OUTER JOIN EMPLOYEE AS S ON E.super_ssn=S.ssn )This will match employees without supervisors.
Link to originalRight Outer Join (SQL)
Right Outer Join (
RIGHT OUTER JOIN): Keeps values from the right table even if they are not matched.SELECT E.name, S.fname FROM ( EMPLOYEE E RIGHT OUTER JOIN EMPLOYEE AS S ON E.super_ssn=S.ssn )This will match employees who are not supervising anyone.
Link to originalFull Outer Join (SQL)
Full Outer Join (
FULL OUTER JOIN): Keeps values from the both tables even if they are not matched.SELECT E.name, S.fname FROM ( EMPLOYEE E FULL OUTER JOIN EMPLOYEE AS S ON E.super_ssn=S.ssn )This will match employees without supervisors and employees not supervising anyone.
Link to original