AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL Cross Join |
SQL > SQL JOIN >
Cross Join
A cross join (also called a Cartesian join) is a join of tables without specifying the join condition. In this scenario, the query would return all possible combination of the tables in the SQL query. To see this in action, let's use the following example: Table Store_Information
Table Geography
The following SQL statement is a Cartesian join between the Store_Information and the Geography tables: SELECT A1.Store_Name STORE1, A2.Store_Name STORE2, A2.Sales SALES
FROM Geography A1 JOIN Store_Information A2; Result:
An alternative way of specifying a cross join is, SELECT A1.store_name STORE1, A2.store_name STORE2, A2.Sales SALES
FROM Geography A1, Store_Information A2; A cross join is seldom the desired result. Rather, it is an indication that some required join condition is missing in the SQL query.
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.