SQL -Structured Query Language - SQL Joins - Cross Join Tutorial
In Cross Join, each record of table 1 is combined with each record of table 2.
We can perform cross joins in multiple tables.
The syntax for cross joins is-
SELECT column_name1,column_name2,..,column_nameN
FROM
table_1 CROSS JOIN table_2;
For example-
SELECT user_name,email ,salary
FROM
user_detail CROSS JOIN user_salary;
Better to use AS (Alias) for the long table name-
SELECT ud.id,ud.user_name,ud.email,us.salary
FROM
user_detail AS ud CROSS JOIN user_salary AS us;
Here we will get a cartesian of record from table 1 and table 2.