Self Joins in oracle database :
The self join is the type of join which perform the join of table to itself.The table on which joins is being performed appears two times under the FROM clause with the name of table aliases which is defined by user.This Alias redirects the column names in the join condition for join operation.
Here I am going to perform a self join for Employee table:
Code:
SELECT emp1.name||' works for '||emp2.name
"Employee and Their Managers"
FROM employee emp1, employee emp2
WHERE emp1.man_id = emp2.emp_id
AND emp1.name LIKE 'R%';
Bookmarks