Page 1 of 1

Multiple Select Queries vs Single Join Query

Posted: Thu Dec 03, 2009 2:58 pm
by csailor
Hi,
Which one of the 2 approaches below is better provided indexes are availabe on the columns - id & dno in respective tables.

Code: Select all

select f.dno, d.dname, c.sname.... 
into :f-dno, :d-dname, :c-sname... 
from 
faculty f,  dept d, stud s 
where f.dno = d.dno 
   and f.dno = s.dno 
   and f.id = :host-var-fac-id 
 
------OR----------

Code: Select all

select f.dno,... into :f-dno,... 
from faculty f where f.id = :host-var-fac-id 

select d.dno, d.dname.... into :d-dno,.... 
from dept d where d.dno = :f-dno 

select s.dno, s.sname... into :s-dno,... 
from stud s where s.dno = :d-dno 


----------------------------------------------------
Elaborate explanation would be appreciated[/code]

Posted: Fri Dec 04, 2009 1:00 pm
by Anuj Dhawan
This thread is alraedy got an answer in other Forum, why don't you follow up there?