Help with SQL
Date: 1996/08/02
Message-ID: <4tscoq$o4i_at_grivel.une.edu.au>#1/1
I am looking for help on a particular SQL query from the book 'Oracle: the Complete Reference' by oracle press. I would like someone to explain the following in fine detail, particularily the last 2nd & 3rd last lines. The SQL is to find all workers who don't have SMITHY as a skill (including those who have no skills listed in the WORKERSKILL table).
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
To quote the book
B.Name is NULL
produces only those workers that don't appear in the WORKERSKILL table (no skills listed), and the
B.Skill(+) = 'SMITHY'
adds those who are in the WORKERSKILL table but who don't have a skill of 'SMITHY' (therefore B.Skill(+) is an invented one).
Originaly the code was
select A.Name, Lodging
from WORKER A, WORKERSKILL B
where A.Name = B.Name(+)
order by A.Name
and this made perfect sense.
Thanks in advance for any help.
Colin Received on Fri Aug 02 1996 - 00:00:00 CEST