What is the output of the query,
SELECT * from Table1 CROSS JOIN table2

 Posted by Kmandapalli on 1/22/2014 | Category: Sql Server Interview questions | Views: 622 | Points: 40
Answer:

Suppose if we have two tables in our database - table1 and table2.
then the CROSS JOIN of the two tables gives the cartesian product of the two tables.

Suppose if we have Employee table containing Employee information and Department table containing Departments.
Then when we implement CROSS JOIN, it will map all the Departments to each Employee and displays the product as below,

Employee1 Dept1
Employee1 Dept2
Employee1 Dept3
Employee2 Dept1
Employee2 Dept2
Employee2 Dept3
.
.
.
.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response