Information Systems ppl please help

Here is a query:

SELECT DISTINCT J#
FROM SPJ SPJX
WHERE NOT EXISTS
( SELECT *
FROM SPJ SPJY
WHERE EXISTS
( SELECT *
FROM SPJ SPJA
WHERE SPJA.S’# = ‘S1’
AND SPJA.P# = SPJY.P# )
AND NOT EXISTS
( SELECT *
FROM SPJ SPJB
WHERE SPJB.S# = ‘S1’
AND SPJB.P# = SPJY.P#
AND SPJB.J# = SPJX.J# ) ) ;

Run on a relation called SPJ (Suppliers Parts projects)…meaning which suppliers provide which parts to which project

so it had S#,P#,J#,qty attributes… What the ^%@#$&#$%*@&# does this query return??

All projects where supplier s1 supplies all the parts to that project??

http://www3.pak.org/gupshup/smilies/frusty.gif

who—me, that’s some query

http://www3.pak.org/gupshup/smilies/pagal.gif

I’ll try solving it (but I am quite certain I’ve forgotten most of what I studied a few months back :hehe

http://www3.pak.org/gupshup/smilies/smile.gif

… and will get back to you.

while yur at it try:

SELECT DISTINCT J#
FROM SPJ SPJX
WHERE NOT EXISTS
( SELECT *
FROM SPJ SPJY
WHERE EXISTS
( SELECT *
FROM SPJ SPJA
WHERE SPJA.S# = SPJY.S1
AND SPJA.P# IN
( SELECT P# FROM P
WHERE COLOR = ‘Red’ )
AND NOT EXISTS
( SELECT *
FROM SPJ SPJB
WHERE SPJB.S# = SPJY.S#
AND SPJB.J# = SPJX.J# ) ) ) ;

too…

http://www3.pak.org/gupshup/smilies/frown.gif

…P is the parts entity..p# is the part number.

[This message has been edited by who—me (edited May 13, 2001).]

who—me, where did you get such complicated ones from?

http://www3.pak.org/gupshup/smilies/mad.gif

The ones I got at Uni never went beyond 6-8 lines.

http://www3.pak.org/gupshup/smilies/crying.gif

They’r from a lab…and I have do same kind on assignment during the week.

Its the correlation thats killing me

http://www3.pak.org/gupshup/smilies/frusty.gif

and the double negation… Mind you…I think both these use double negatives

feel like throwing up

http://www3.pak.org/gupshup/smilies/pukey.gif