SQLite Cross Join

The SQLite Cross join is used to match every rows of the first table with every rows of the second table. If the first table contains x columns and second table contains y columns then the resultant Cross join table will contain the x*y columns.

Syntax:

snippet
SELECT ... FROM table1 CROSS JOIN table2

Image Representation:

Sqlite Cross join 1

We have two tables "STUDENT" and "DEPARTMENT".

Sqlite Cross join 2

The "STUDENT" table is having the following data:

Sqlite Cross join 3

The "DEPARTMENT" table is having the following data:

Sqlite Cross join 4

Example:

Select all records from tables STUDENT and DEPARTBMENT after cross join:

snippet
SELECT * FROM COMPANY CROSS JOIN DEPARTMENT;
Sqlite Cross join 5
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents