The CROSS JOIN keyword returns all records from both tables (table1 and table2).
CROSS JOIN Syntax
SELECT column_name(s)
FROM table1
CROSS JOIN table2;
Given below is a selection of name table
SQL CROSS JOIN Example
The following SQL statement selects all customers, and all orders:
Note: The CROSS JOIN keyword returns all matching records from both tables whether the other table matches or not. So, if there are rows in "name" that do not have matches in "age", or if there are rows in "age" that do not have matches in "name", those rows will be listed as well.
If you add a WHERE clause (if table1 and table2 has a relationship), the CROSS JOIN will produce the same result as the INNER JOIN clause:
No comments:
Post a Comment