Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Self join in the HR schema

Daniel TaitMar 13 2013 — edited Mar 27 2018
I'm a beginner going though a tutorial on joins using the HR schema:

an example of a self join was given as:

SELECT e.last_name AS Employee, m.last_name AS Manager
FROM employees e INNER JOIN employees m
ON (e.manager_id = m.employee_id);

this executes correctly, giving a column of Employee's name and their manager's name . However, I'm having trouble wrapping my head around the ON clause in this statement.

For example if I change the ON clause so that the statement is:

SELECT e.last_name AS Employee, m.last_name AS Manager
FROM employees e INNER JOIN employees m
ON (m.manager_id = e.employee_id);

I no longer get the correct answer but I'm not sure why?
This post has been answered by sb92075 on Mar 13 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2013
Added on Mar 13 2013
3 comments
1,392 views