Home » SQL & PL/SQL » SQL & PL/SQL » EXISTS Vs Correlated subquery
EXISTS Vs Correlated subquery [message #215720] Tue, 23 January 2007 11:34 Go to next message
shivaram9
Messages: 35
Registered: August 2006
Member
Hi all,

Could you tell me which one is better to use (EXISTS or Correlated subquery) and why?

Thanks,
Shivaram
Re: EXISTS Vs Correlated subquery [message #215722 is a reply to message #215720] Tue, 23 January 2007 11:41 Go to previous message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
In my experience, an EXISTS usually is a correlated subquery. A correlated subquery is any query in which the tables in the subquery are joined back to a table or tables in the main query e.g.

select * from emp e
where exists
(select 1 from dept d
where d.dept_id = e.dept_id)

This would be a correlated subquery. It would only be not correlated if you had something like:

select * from emp e
where exists
(select 1 from dept d)

Previous Topic: How to Upload From Client to FTP with PL/SQL Server Pages
Next Topic: ORA-00942 ERROR
Goto Forum:
  


Current Time: Mon Dec 05 19:17:04 CST 2016

Total time taken to generate the page: 0.08373 seconds