SQL-J Language Reference
Page 19 of 121

CROSS JOIN

A CROSS JOIN is one of the JOIN operations. It provides a way to specify a Cartesian product between two tables: it does not allow you to specify the join column. You can, however, specify a WHERE clause.

Syntax

TableExpression CROSS JOIN TableExpression

Example

SELECT *
FROM Flights CROSS JOIN Airlines
WHERE orig_airport = 'SFO'
AND dest_airport = 'LAX'

SELECT *
FROM (VALUES (1, 2), (3, 4)) AS Peter(apples, oranges)
CROSS JOIN
(VALUES ('a', 'b'), ('c', 'd')) AS Paul (bananas, pineapples)

APPLES     |ORANGES    |BANANAS    |PINEAPPLES
--------------------------------------------------
1          |2          |a          |b
1          |2          |c          |d
3          |4          |a          |b
3          |4          |c          |d