4
Reply

What is a SELF JOIN in SQL ?

Ajeet Mishra

Ajeet Mishra

9y
511
0
Reply

    Its a kind of join which join a table to itself.

    http://www.tutorialspoint.com/sql/sql-self-joins.htm

    Self join means we are creating join on same table.Suppose we have a table employee Emp_id,emp_name,manager_id.Now if we want to get emp_name ,manager_name from this table we need to do self join .Select a.emp_name,b.emp_name as managername from employee a,employee b where a.manager_id=b.emp_id

    Same table is specified twice with two different aliases in order to match the data within the same table.