Are full outer join and Cross join are same? ( SQL Server interview questions with answers)
- By Shiv Prasad Koirala in SQL
- Oct 19th, 2013
- 20353
- 0
No, they are not. Full outer join returns common records in both the tables + uncommon records for left table + uncommon records from right table. Where as in Cross Join we will get Cartesian product, that means every record of left table will be combined with every row in right table and result was returned back.
Example:
Table 1
|
Table 2
|
Full Outer Join
Column 1 |
Column2 |
Column2 |
Column3 |
A |
X |
X |
XName |
B |
Y |
Y |
YName |
C |
Z |
NULL |
NULL |
D |
W |
NULL |
NULL |
NULL |
NULL |
P |
PName |
NULL |
NULL |
O |
OName |
Cross join
Select * from Table1, Table2
Column 1 |
Column2 |
Column2 |
Column3 |
A |
X |
X |
XName |
A |
X |
Y |
YName |
A |
X |
P |
PName |
A |
X |
O |
OName |
B |
Y |
X |
XName |
B |
Y |
Y |
YName |
B |
Y |
P |
PName |
B |
Y |
O |
OName |
C |
Z |
X |
XName |
C |
Z |
Y |
YName |
C |
Z |
P |
PName |
C |
Z |
O |
OName |
D |
W |
X |
XName |
D |
W |
Y |
YName |
D |
W |
P |
PName |
D |
W |
O |
OName |
Explanation to Inner Join , Left Join and Right Join.
Here is our latest 20+ SQL Interview Questions and Answers video :-
For further references please visit www.questpond.com which has more than 600+ videos on .Net Step by Step and Interview Questions with Answers.
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more