CROSS JOIN in SQL Server

Posted by Sqldev under Sql Server on 5/1/2012 | Points: 10 | Views : 2822 | Status : [Member] | Replies : 9
Cross join or Cartesian product is less frequently used but more confusing join in SQL Server.

Here is an article which gives complete information about CROSS JOIN in SQL Server:

http://learnsqltips.blogspot.in/2012/04/cross-join-in-sql-server.html




Responses

Posted by: Sriramnandha on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Cross join is an Cartesian Product its Matrix Format Like 3 * 3 ,5 * 5 format.

create table table_one (col_one number, col_two varchar2(10));
create table table_two (col_three number, col_four varchar2(10));
insert into table_one values ( 1, 'one');
insert into table_one values ( 2, 'two');
insert into table_two values (10, 'ten');
insert into table_two values (20, 'twenty');
insert into table_two values ( 5, 'five');
select * from
table_one cross join
table_two;
Each row from table_one is returned together with each row from table_two:

Regards

Sriram.R

sriram

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/20/2012 [Member] Bronze | Points: 25

Up
0
Down
The SQL CROSS JOIN produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table, if no WHERE clause is used along with CROSS JOIN. This kind of result is called as Cartesian Product

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/20/2012 [Member] Bronze | Points: 25
Posted by: CGN007 on: 6/20/2012 [Member] Silver | Points: 25

Up
0
Down
CROSS JOIN
This join is a Cartesian join that does not necessitate any condition to join. The resultset contains records that are multiplication of record number from both the tables

Please refer more details here http://blog.sqlauthority.com/2009/04/13/sql-server-introduction-to-joins-basic-of-joins/

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muralidosscm on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
msdn.microsoft.com/en-us/library/ms190690(v=sql.105).aspx

Regards
Muralidoss M

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: saficreator-10970 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
CROSS JOIN:
This join is a Cartesian join that does not necessitate any condition to join. The resultset contains records that are multiplication of record number from both the tables.

example:
select * from table1,table2
or
select * from table1 cross join table2

http://blog.sqlauthority.com/2009/04/13/sql-server-introduction-to-joins-basic-of-joins/

Regards,
Mohamed Shafee M


Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 7/31/2012 [Member] Silver | Points: 25

Up
0
Down
please mark it as answer....That helps other who search the same...

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/31/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hii..
check this url
http://www.java2s.com/Tutorial/SQLServer/0080__Table-Join/SQL92CrossJoinSyntax.htm

Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/31/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Mark As Answer, if post helps u.


Sqldev, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response