#005

Опубликовано: 19 Октябрь 2024
на канале: Programming World
26
4

This is a SQL Server tutorial about INNER JOIN & CROSS JOIN.

INNER JOIN : It needs to map the columns from both the tables using ON condition.

CROSS JOIN : It does not use any ON condition to map the columns from both tables, It internally mapped the each records from both tables.
eg.

------------------------------------------------------------
Table 1

Col1 Col2
A 1
B 4
C 11
D 35
-------------------------------------------------------------
Table 1

Col1 Col2
X 18
Y 40
Z 5
------------------------------------------------------------
CROSS JOIN Result : ( 4 * 3 = 12 records)

Table 1 x Table 2

Col1 Col2 Col1 Col2
A 1 X 18
A 1 Y 40
A 1 Z 5
B 4 X 18
B 4 Y 40
B 4 Z 5
C 11 X 18
C 11 Y 40
C 11 Z 5
D 35 X 18
D 35 Y 40
D 35 Z 5
--------------------------------------------------

Download Script :
https://bit.ly/2AWg9To

#SQLServer
#MSSQL
#SQL