Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How the join works

782493May 18 2011 — edited May 19 2011
Hi,

Could you please tell me how the below join works

Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a, Table2 b, Table3 c, Table4 d
where
a.col4 = b.col4 (+)
and c.col4(+) = d.col4

How do this tables are joining and displays the result.
This post has been answered by Frank Kulash on May 18 2011
Jump to Answer

Comments

sb92075
How do this tables are joining and displays the result.
nice example of Cartesian Product!
782493
Thx

Will the below item work ?

Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a, Table2 b, Table3 c, Table4 d
where
a.col4 = b.col4
b.Col3=c.col3
and c.col4(+) = d.col4
Frank Kulash
Answer
Hi,
VJ wrote:
Hi,

Could you please tell me how the below join works

Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a, Table2 b, Table3 c, Table4 d
where
a.col4 = b.col4 (+)
and c.col4(+) = d.col4
(1) There is an inner join between a and b: rows in a will be joined to rows in b if they have the same value of col4.
(2) There is an outer join between c and d: rows in c will be joined to rows in d if they have the same value of col4, but rows from c will appear regardless of whether they match or not.
(3) There are no other join conditions, so there is a cross join between the result sets of (1) and (2): every row in each will be joined to every row in the other.
Marked as Answer by 782493 · Sep 27 2020
860993
This is my thinking method.

first step is cross join and inner join but excludeing left join.
second step is left join.
Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a
inner join Table2 b on a.col4 = b.col4
cross join Table3 c
left join Table4 d on c.col4 = d.col4
782493
Thx
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 16 2011
Added on May 18 2011
5 comments
662 views