SQL TUNING

In this forum you can share stuff related to Oracle 11g, 10g, 9i.
Post Reply
kareem2003
Posts: 40
Joined: Tue Jun 12, 2007 11:25 am
Location: India
Contact:

SQL TUNING

Post by kareem2003 »

Can nay one tell me that Sql Tuning

what is IN,
NOT IN and
EXISTS,
NOT EXISTS
where are the about 4 terms we may use?
If possible with examples.
have a nice day
amirtai
Posts: 138
Joined: Sat Apr 08, 2006 5:54 pm
Location: Canada
Contact:

Post by amirtai »

Hi

Here are few examples to grasp some idea:

select DEPTNO from EMP
where (DEPTNO=10) or (DEPTNO=20);

Same result could be obtain With IN or NOT IN:

select DEPTNO from EMP
where DEPTNO in(10,20);

Likewise the use of EXISTS or NOT EXISTS must return TRUE if at least one condition is met. We want to check which DEPTNO has no employee.

select d.DEPTNO from dept d
where not exists
(select e.DEPTNO from EMP e where d.DEPTNO=e.DEPTNO);

Hope that would be helpfull to you.

Thanks
Amir
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests