ORACLE
ORACLE JOINS
INNER JOIN
OUTER JOIN
EQUI JOIN
SELF JOIN
CROSS JOIN
ANTI JOIN
SEMI JOIN
ORACLE TUTORIAL
Oracle Introduction
What Is Oracle
Create Tables
What Is Oracle
ORACLE TABLES
Create Tables
Create Table As
Alter Table
Drop Table
Global Temorary Tables
Local Temorary Tables
ORACLE VIEWS
Create View
ORACLE QUERIES
SELECT
INSERT
INSERT
INSERT ALL
UPDATE
DELETE
TRUNCATE TABLE
ORACLE CLAUSES
DISTINCT
FROM
ORDER BY
GROUP BY
HAVING
ORACLE OPERATORS
UNION
UNION ALL
INTERSECT
MINUS
ORACLE ADVANCE
PROCEDURES
FUNCTION
CURSOR
TRIGGER

CROSS JOIN(Cartesian Product)



Oracle - Cross Join


The CROSS JOIN specifies that all rows from first table join with all of the rows of second table. If there are "a" rows in table1 and "b" rows in table2 then the cross join result set have a*b rows. It normally happens when no matching join columns are specified.

In simple words you can say that if two tables in a join query have no join condition, then the Oracle returns their Cartesian product.


Syntax
SELECT *   
FROM table1   
CROSS JOIN table2;  

OR

SELECT * FROM table1, table2  

Both the above syntax are same and used for Cartesian product. They provide similar result after execution.


Oracle Cross Join Example


Let's take two tables "customer" and "supplier".


Customer table detail

CUSTOMER_IDFIRST_NAMELAST_NAME
1Nirakshsarkar
2NiroopPritala
3SweejyaMehtha
4DeepuNehra

Supplier table detail

SUPPLIER_IDFIRST_NAMELAST_NAME
1AjayBhalla
2NynikaKapoor
3FarahKhan

Execute this query :

SELECT * FROM Customer,Supplier;

OR

SELECT * 
FROM Customer 
CROSS JOIN Supplier;

OUTPUT :

CUSTOMER_IDFIRST_NAMELAST_NAMESUPPLIER_IDFIRST_NAMELAST_NAME
1Nirakshsarkar1AjayBhalla
1Nirakshsarkar2NynikaKapoor
1Nirakshsarkar3FarahKhan
2NiroopPritala1AjayBhalla
2NiroopPritala2NynikaKapoor
2NiroopPritala3FarahKhan
3SweejyaMehtha1AjayBhalla
3SweejyaMehtha2NynikaKapoor
3SweejyaMehtha3FarahKhan
4DeepuNehra1AjayBhalla
4DeepuNehra2NynikaKapoor
4DeepuNehra3FarahKhan


What Is Oracle

What Is Oracle

posted on 2019-11-29 01:11:21 - ORACLE Tutorials


TRIGGER

ORACLE - Trigger

posted on 2019-11-28 22:14:22 - ORACLE Tutorials


CURSOR

ORACLE - Cursor

posted on 2019-11-28 22:13:54 - ORACLE Tutorials


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials