DATABASE & SQL/PLSQL

adplus-dvertising
Cross Join
Previous Home Next

A join that included more than one table using keyword CROSS is called cross join.

The output of a such type of join is called Cartesian product.

In cross join each row of first table is joined to with the each row of second table.

The number of rows in the result set is the multiple of the first table rows and second table rows.

SELECT  column_name 1, column_name 2....column_name n
FROM  table_name  CROSS JOIN  table_name

Example:

SELECT *
FROM sales CROSS JOIN publishers

output

returns 168 rows, after cross join 21 rows of sales table and 8 rows of publishers tables.

Previous Home Next