MySQL CROSS JOIN

The CROSS JOIN keyword in MySQL returns the Cartesian product of two tables, which means that it returns all possible combinations of rows from both tables.

The syntax for using CROSS JOIN is as follows:

SELECT *
FROM table1
CROSS JOIN table2;

In this syntax, table1 and table2 are the names of the tables you want to join. The * symbol is a wildcard that selects all columns from both tables.

Here is an example of how to use CROSS JOIN in MySQL:

Suppose you have two tables, employees and departments, and you want to create a report that shows all possible combinations of employees and departments. You can use the following query:

SELECT *
FROM employees
CROSS JOIN departments;

This query will return a result set that contains all possible combinations of rows from the employees and departments tables.

Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial