Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Replacing NOT IN with an outer join
Can anyone explain to me in detail why the following two statements are
equivalent? (This example is taken from page 289 of the Oracle 8
Reference Manual). I understand everything up to the last line (and
B.Skill(+) = 'SMITHY'...). The reference manual does not explain what
this statement is doing, and I can not figure out why this statement
ends up selecting everyone who is not a smithy. It seems completely
counter-intuitive to me. Thanks.
select A.Name, Lodging
from WORKER A
where A.Name NOT IN
(select Name from WORKERSKILL where Skill = 'SMITHY')
___AND___
select A.Name, Lodging
from WORKER A, WORKERSKILL B
where A.Name = B.Name(+)
and B.Name is NULL
and B.Skill(+) = 'SMITHY' order by A.Name;
Received on Fri Sep 04 1998 - 12:19:06 CDT