Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL outer join question
I've been reading 'Oracle the complete reference' from Osborne Press.
I found the following: assume 2 tables
create table worker ( name char(10), location char(10))
create table workerskill ( name char(10), skill char(10))
sample date worker:
white LA brown NY green LO blue DN sample data workerskill: white forms brown oracle green unix
Need a query that shows all workers, name and location, who do NOT have unix. This should include those who have no skills.
Normally I would use;
select name, location
from worker
where name not in ( select name from workerskill )
The book gives a more efficient piece of sql that uses outer joins
select name, location
from worker w, workerskill s
where w.name = s.name(+)
and s.name is null
and s.skill(+) = 'unix'
Can anybody explain how this works ? The book just says the login
is 'extremely obscure'
I can see the first condition produces a list of all workers
(outer join), I don't understand the reason for next 2 conditions.
Thanks for any help.
Paul Sellars Received on Fri Jul 31 1998 - 12:09:56 CDT
![]() |
![]() |