Produces the cartesian product of two tables — every row of the left combined with every row of the right. No join condition.
Produces a Cartesian product: every row in the first table paired with every row in the second. Can be extremely large and expensive. Occasionally useful for generating combinations (e.g., all date/user pairs) when paired with a WHERE clause that filters most results away.
Compatibility
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | Native | all | CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product. |
| PostgreSQL | Native | all | CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product. |
| SQL Server | Native | all | CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product. |
| Oracle | Native | all | CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product. |
| SQLite | Native | all | CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product. |
Details
Rarely needed in application code but useful for generating combinations or test data. N rows × M rows = N*M result rows.
Standard Syntax
Version Support
Per-Database Syntax & Notes
MySQL Native syntax
CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product.
PostgreSQL Native syntax
CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product.
SQL Server Native syntax
CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product.
Oracle Native syntax
CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product.
SQLite Native syntax
CROSS JOIN keyword or comma syntax (FROM a, b) both produce a cartesian product.