Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle CROSS JOIN

In Oracle, CROSS JOIN is used to fetch all rows from both the tables, where each row in the result set is the combination from both the tables. This is happens because it does not have the join conditions.

Oracle CROSS JOIN Syntax

To fetch all records from both the joined tables, use the following syntax:

Syntax

SELECT col1, col2,....
FROM tablename1
CROSS JOIN tablename2

OR

SELECT * FROM tablename1, tablename2  

Parameters:

tablename1 & tablename2: The table name from which you want to fetch records.

col1: The column or field name that will be return.

Oracle CROSS JOIN example

The following Oracle, fetching all records from "tblbankheadquartersandaddress" and "tblbankdemataccountcharges" tables using CROSS JOIN:

Example

SELECT *
FROM tblbankdemataccountcharges 
CROSS JOIN tblbankheadquartersandaddress
LIMIT 10;

Note:

In the above example, we are fetching all record from both "tblbankheadquartersandaddress" and "tblbankdemataccountcharges" tables using CROSS JOIN.