July 19, 2017

Right Join

Every rows from right table and matching records from left

select
emp.id,
emp.name,
dept.name
from employee emp
right join department dept
on emp.dept_id = dept.dept_id

Even if the department doesn't have employees, it will be listed. If an employee doesn't have a department, it will not be listed.

No comments:

Post a Comment