explain the following: Alternative syntax for JOIN queries; The dangers/risks associated with the Cartesian product/ CROSS JOIN.
explain the following:
Alternative syntax for JOIN queries;
The dangers/risks associated with the Cartesian product/ CROSS JOIN.
The CROSS JOIN is used to generate a paired combination of each row of the first table with each row of the second table. This join type is also known as cartesian join.
The main idea of the CROSS JOIN is that it returns the Cartesian product of the joined tables.
The syntax of the CROSS JOIN in SQL will look like the below syntax:
SELECT ColumnName_1,
ColumnName_2,
ColumnName_N
FROM [Table_1]
CROSS JOIN [Table_2]
Here the alternative syntax of JOIN. This does not include the CROSS JOIN keyword; only we will place the tables that will be joined after the FROM clause and separated with a comma.
SELECT ColumnName_1,
ColumnName_2,
ColumnName_N
FROM [Table_1],[Table_2]
The result set does not change for either of these syntaxes. In addition, we must notice one point about the CROSS JOIN. Unlike the INNER JOIN, LEFT JOIN and FULL OUTER JOIN, the CROSS JOIN does not require a joining condition.
Step by step
Solved in 2 steps