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!

how inner join is execute for 3 tables

User_3YG1KApr 17 2022

hi,
I have tables like below.
Create Table o1(c_1 number, c_2 Varchar2(30), c_3 Number);
Select * From o1;
Insert Into o1 Values(&c_1,'&c_2',&c_3);
Commit;
C_1 C_2 C_3
1 aaa 111
2 bbb 111
3 bbb 222
4 ccc 333
Create Table o2(c_1 Number,c_2 Varchar2(30));
Select * From o2;
Insert Into o2 Values(&c_1,'&c_2');
Commit;
C_1 C_2
111 xxx
222 xxx
333 yy
444 yy
Create Table o3(c_1 Varchar2(30), c_2 Number);
Select * From o3;
Insert Into o3 Values('&c_1',&c_2);
Commit;
C_1 C_2
xx 1000
yy 2000
zz 3000
vv 4000
-----> performing inner join
Select * From o1 Inner Join o2
On o1.c_3=o2.c_1 Inner Join o3
On o3.c_1=o2.c_2;
I want to know how, the join executes
-------> here is my guess. let me know it is right or not , as the results differ when i execute and when i write on my paper.
first it executes from the bottom
result -----> o1.c_3=o2.c_1 Inner Join o3 On o3.c_1=o2.c_2
---> then
select *from o1 inner join (result of ----> o1.c_3=o2.c_1 Inner Join o3 On o3.c_1=o2.c_2 )
-----> is this the same .Plz let me know.
Thanks for the timely reply.

Comments
Post Details
Added on Apr 17 2022
1 comment
448 views