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
Messages: 35
Registered: August 2006
Hi all,

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

Re: EXISTS Vs Correlated subquery [message #215722 is a reply to message #215720] Tue, 23 January 2007 11:41 Go to previous message
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: Analytic with Count
Next Topic: Column Keyword
Goto Forum:

Current Time: Tue Aug 22 21:10:54 CDT 2017

Total time taken to generate the page: 0.01831 seconds