CROSS-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.suppose if we have 10 records in table A and 5 records in table B,it will return 50(10*5) records.
Ex:
Left Table(emp Table)
--------------------------------
empID FirstName
--------------------------------
1 John
2 Steve
---------------------------------
Right Table(dept Table)
------------------------------------------------------
empID DeptName
------------------------------------------------------
1 IT
2 Networking
------------------------------------------------------
Query:
SELECT * FROM emp AS e FULL JOIN dept AS d
Result:
empID FirstName IndividualId AccessLevel
1 John 1 IT
1 John 2 Networking
2 Steve 1 IT
2 Steve 2 Networking
Ex:
Left Table(emp Table)
--------------------------------
empID FirstName
--------------------------------
1 John
2 Steve
---------------------------------
Right Table(dept Table)
------------------------------------------------------
empID DeptName
------------------------------------------------------
1 IT
2 Networking
------------------------------------------------------
Query:
SELECT * FROM emp AS e FULL JOIN dept AS d
Result:
empID FirstName IndividualId AccessLevel
1 John 1 IT
1 John 2 Networking
2 Steve 1 IT
2 Steve 2 Networking
No comments:
Post a Comment