- Oct 11, 2000
- 16,843
- 2
- 0
Hi I need some SQL help.
I have the following questions asked of me here:
http://homepage.ntlworld.com/ph.chea/Sql%20work.pdf
I have written out the answers here. I was wondering if they are correct.
Thanks Koing
I have the following questions asked of me here:
http://homepage.ntlworld.com/ph.chea/Sql%20work.pdf
I have written out the answers here. I was wondering if they are correct.
Question 1:
Query1:
SELECT sname
FROM supplier s
WHERE NOT EXISTS
(SELECT *
FROM Part p
WHERE p.colour = ?blue? AND
NOT EXISTS
(SELECT *
FROM project j
WHERE j.jcity = ?Athens? V j.jcity = ?Rome? AND
NOT EXISTS
(SELECT *
FROM spj x
WHERE s.s# = x.s# AND p.p# = x.p# AND j.j# = x.j#)));
Query2:
SELECT sname, status
FROM supplier s
WHERE s.scity = ?Paris? AND
NOT EXISTS
(SELECT *
FROM Part p , Project j
WHERE p.colour = ?Red? AND j.jcity = ?London? AND
EXISTS
(SELECT *
FROM spj x
WHERE s.s# = x.s# AND p.p# = x.p# AND j.j# = x.j#));
Question 2:
SELECT spj.p# , SUM(spj.qty)
FROM spj
PROJECT WHERE NOT PROJECT.jcity = ?Oslo?
GROUP BY spj.p#
HAVING SUM (spj.qty) > 500
Question 3:
UPDATE spj
SET qty = qty * 1.1
SELECT scity, pname, jcity
FROM supplier s, part p , project j
WHERE s.scity = ?London? AND p.pname = ?nuts? AND j.jcity = ?Paris?
Thanks Koing
