A self join is a join in which a table is joined with itself. For example, when you require details about an employee and his manager (also an employee)
A self join is basically when a table is joined to itself. The way you should visualize a self join for a given table is by imagining that a join is performed betweentwo identical copies of that table. And that is exactly why it is called aselfjoin – because of the fact that it’s just the same table being joined to anothercopyof itself rather than being joined with a different table.
SELECT e1.Emp_ID,e1.Emp_Name,e1.Emp_Sal
FROM employee e1, employee e2
WHERE e1.Location = e2.Location
AND e2.Location='allahabad'
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
A self join is basically when a table is joined to itself. The way you should visualize a self join for a given table is by imagining that a join is performed between two identical copies of that table. And that is exactly why it is called a self join – because of the fact that it’s just the same table being joined to anothercopy of itself rather than being joined with a different table.