source: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/2412fe92-7ea6-4de2-9599-c0075f246e23/cross-join-vs-full-outer-join?forum=transactsql
Full outer join returns all matching rows from A and B and all Rows from A that are not in B and all rows from B that are not in A.
example:
A
1
2
3
2
3
B
2
3
4
2
3
4
select * from A full join B on A.id = B.ID
Output
Output
A B
1 NULL
2 2
3 3
NULL 4
1 NULL
2 2
3 3
NULL 4
In a cross join you will get 9 rows combined with each other:
select * from A cross join B
A B
1 4
2 4
3 4
1 2
2 2
3 2
1 3
2 3
3 3
A B
1 4
2 4
3 4
1 2
2 2
3 2
1 3
2 3
3 3
Note:
However, if a WHERE clause is added, the cross join behaves as an inner join. For example, the following Transact-SQL queries produce the same result set.
댓글
댓글 쓰기