What do we mean by self-join and cross-join?

 Posted by vishalneeraj-24503 on 11/27/2013 | Category: Sql Server Interview questions | Views: 1818 | Points: 40

1). self-join and cross-join both produces the same output.
2). self-join is applied in same table only whereas cross-join is applied in different tables.
3). in case of self-join,we have to give alias name in table but in case of cross-join, it may or may not required.

Syntax of self-join:-

select * from employee_master A,employee_master B;

Syntax of cross-join:-

select * from employee_master A,project_master B;

//or we can also write as:-

select * from employee_master,project_master;

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response