SQL with Jupyter Notebook Tutorial

25 / 61

Outer Joins

Outer joins are for finding records that may not have a match in the other table. You specify which side of the join is allowed to have a missing record.

left outer join (or just left join) -> Table on right side can have missing records right outer join (or just right join) -> Table on left side can have missing records

%%sql
select
e.empid
, concat(e.empfname,' ',e.empfname) "employee"
, e.mgrempid
, concat(m.empfname,' ',m.emplname) "manager"
from emp_<<your lab username>> e left outer join emp_<<your lab username>> m
on e.mgrempid = m.empid
order by 1,2
;

In above example, empid 1 doesn't have manager id, so manager name will be displayed as NULL rather than not displaying row for empid 1 at all.


No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...