Home » SQL & PL/SQL » SQL & PL/SQL » EXISTS
EXISTS [message #2157] Tue, 25 June 2002 03:36 Go to next message
Paramaguru
Messages: 4
Registered: June 2001
Junior Member
What is the diff. between IN and EXISTS ?
Re: EXISTS [message #2158 is a reply to message #2157] Tue, 25 June 2002 03:57 Go to previous message
ajay
Messages: 45
Registered: December 2000
Member
IN is to check for a set of values
Select * from emp
where deptno in (select deptno from dept)

EXISTS is used for a correlated subquery to check the existence of any condition for the row in the outer query to considered for selection

Select * from emp e
Where exists (select 1 from deptno d
where d.deptno = e.deptno)

EXISTS is faster then IN
Previous Topic: ALTER TABLE COMMAND
Next Topic: Re: Question
Goto Forum:
  


Current Time: Thu Apr 25 16:32:45 CDT 2024