Halloween Sale: Flat 70% + Addl. 25% Off + 30 Days Extra Lab on all Courses | Use Coupon HS25 in Checkout | Offer Expires In

  Enroll Now

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

select
e.empid
, concat(e.empfname,' ',e.empfname) "employee"
, e.mgrempid
, concat(m.empfname,' ',m.emplname) "manager"
from emp e left outer join emp 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...