What is CROSS JOIN in SQL Server ?

CROSS JOIN makes the cross relation between two or more table. It return the combination of all rows from both table.

If we have two table one table having three record and another table having two record and when we apply CROSS JOIN on both table it will return six rows.

cross join example in sql server

Consider the below result.

cross join example in sql server

Syntax of Self Join

SELECT < list of columns >
FROM table1 AS t1
table1 AS t2

Note : In CROSS JOIN we not use the ON keyword because CROSS JOIN multiply the record from both table.

Apply CROSS JOIN on above result set.


SELECT SD.StudentId,SD.StudentName,SD.City, SC.StudentContact
FROM tblStudentDetails SD
tblStudentContact SC


cross join example in sql server