CROSS JOIN
The CROSS JOIN is used to generate a paired combination of each row of the first table with each row of the second table. This join type is also known as cartesian join.
If WHERE clause is used with CROSS JOIN, it functions like an INNER JOIN.
The below code returns all combination Meals with all Drinks
CROSS JOIN - Popular snippets
- MS SQL Server 2017 CREATE TABLE MONTH INSERT INTO WITH SELECT CROSS JOIN COALESCE SUM ORDER BY LEFT JOIN
last run:
2023-12-09 08:16:08
104
- MySQL 5.7 CREATE TABLE MONTH INSERT INTO WITH SELECT CROSS JOIN COALESCE SUM ORDER BY LEFT JOIN
last run:
2024-12-19 07:47:24
36
- MySQL 8.0 CREATE TABLE NOT SELECT INSERT INTO WITH WHERE AND LEFT JOIN LAG ORDER BY GROUP BY LIKE COUNT CROSS JOIN LEAD IFNULL
last run:
2023-05-31 16:19:37
29
- Oracle Database 21c CREATE TABLE INSERT INTO SELECT ALTER TABLE UPDATE WHERE TRUNCATE DROP TABLE DELETE CREATE VIEW NOT PRIMARY KEY FOREIGN KEY INNER JOIN LEFT JOIN RIGHT CROSS JOIN
last run:
2023-05-31 16:17:04
27
- MS SQL Server 2017 CREATE TABLE INSERT INTO SELECT WHERE CROSS JOIN
last run:
2024-10-28 14:06:55
26
- PostgreSQL 15 CREATE TABLE INSERT INTO SELECT CROSS JOIN GROUP BY
last run:
2023-05-12 01:22:40
16
- PostgreSQL 12 WITH SELECT CROSS JOIN WHERE ORDER BY AND SUM INNER JOIN GROUP BY
last run:
2024-08-02 20:30:07
15
- PostgreSQL 14 WITH SELECT UPDATE DELETE UPPER CROSS JOIN GROUP BY
last run:
2024-02-17 02:58:35
15
- MySQL 8.0 Sakila (ReadOnly) WITH SELECT COUNT SUM JOIN LEFT GROUP BY CROSS JOIN ORDER BY
last run:
2024-11-21 16:42:01
13
- PostgreSQL 10 Bookings (ReadOnly) WITH SELECT CROSS JOIN WHERE LEFT JOIN AND GROUP BY ORDER BY
last run:
2024-10-26 16:24:09
13
CROSS JOIN - New snippets
-
PostgreSQL 15 CREATE TABLE PRIMARY KEY NOT DEFAULT ALTER TABLE ADD CONSTRAINT IN INSERT INTO BETWEEN AND CONSTRAINT FOREIGN KEY SELECT CROSS JOIN ORDER BY
added at:
2025-01-22 17:22:32
2
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE AND ORDER BY
added at:
2025-01-22 12:25:22
1
-
MySQL 8.0 Sakila (ReadOnly) SELECT CROSS JOIN WHERE
added at:
2025-01-21 14:00:41
1
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE AND GROUP BY JOIN ORDER BY
added at:
2025-01-21 11:45:43
1
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE OR GROUP BY JOIN AND ORDER BY
added at:
2025-01-21 11:45:20
1
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE AND GROUP BY JOIN ORDER BY
added at:
2025-01-21 11:44:24
2
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE GROUP BY JOIN AND ORDER BY
added at:
2025-01-21 11:35:54
4
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE GROUP BY JOIN AND ORDER BY
added at:
2025-01-21 11:35:38
6
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE GROUP BY JOIN AND ORDER BY
added at:
2025-01-21 11:34:24
1
-
PostgreSQL 10 Bookings (ReadOnly) SELECT CROSS JOIN WHERE GROUP BY JOIN AND ORDER BY
added at:
2025-01-21 11:34:15
2