/    /  MySQL – CROSS JOIN

MySQL – CROSS JOIN

 

MySQL - CROSS JOIN

A MySQL CROSS JOIN is used to combine all possible results from two or more tables and return a result containing every row from all contributing tables. The CARTESIAN JOIN is also known as the CROSS JOIN, and it provides the Cartesian product of all the tables associated with the CROSS JOIN. A Cartesian product is the product of all rows present in a first table multiplied by the rows present in a second table. Similar to the Inner Join, this clause does not allow the joining condition to be specified.

Syntax

SELECT column-lists  
FROM table1  
CROSS JOIN table2;  

In the above syntax, column-lists represents the column or field that you want to return, and table1 and table2 represent the table names from which the records are fetched.

Example

SELECT *  
FROM dept_emp 
CROSS JOIN employees ;  

MySQL - CROSS JOIN