SELF JOIN

A SELF JOIN is a join of a table to itself.

Here are two ways in which SELF JOIN may be accomplished

Example 2: this example uses the same table twice on the from selector

SELECT e1.last_name||’ works for ‘||e2.last_name
“Employees and Their Managers”
FROM employees e1, employees e2
WHERE e1.manager_id = e2.employee_id
AND e1.last_name LIKE ‘R%’
ORDER BY e1.last_name;

Employees and Their Managers

The join condition for this query uses the aliases e1 and e2 for the sample table employees:

e1.manager_id = e2.employee_id

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top