Interviews3 answers
What is a self join?

Bhasker Das
Posted Jul 13, 2006, 3:24 AM EDT3 Answers
Self join is join which is join against equality-Like
Employee Id is the Id of Manager
Select E.Name as E,M.Name as M
from Emp
Where E.id=M.id
where
Santosh KumarPosted Jun 28, 2016, 3:31 AM EDT
Just in case, if they ask you to write query....
TableName: T1, Columns: EId, EName, MId
select E1.EId as EmployeeId, E1.Ename as EmployeeName, E2.EName as ManagerName
from T1 as E1, T1 as E2 where E1.MId = E2.EId
nbpPosted Aug 2, 2006, 11:10 PM EDT
Self join is just like any other join, except that two instances of the same table will be joined in the query. Here is an example: Employees table which contains rows for normal employees as well as managers. So, to find out the managers of all the employees, you need a self join.
Bhasker DasPosted Jul 13, 2006, 3:24 AM EDT

