Documente Academic
Documente Profesional
Documente Cultură
assig2.doc
ASSIGNMENT #2
DUE DATE: February 24
(1) Print the P# and CITY of each Red part that has weight > 13.
My Answer:
Select p#, city From p where Weight > 13 AND Color =’Red’
(3) Print the pairs of J#s such that there is a shipment for
each project in the pair involving the same part and having
QTY > 200.
My Answer: Select J# from SPJ where qty > 200 group by p#,
j#
(4) (a) Print the J#s of projects that are supplied with a Nut
and are also supplied with a London part.
My Answer: Select spj.j# from spj where spj.p# in (select
p.p# from where p.name=’Nut’ AND p.city=’London’)
(b) Print the J#s of projects that are supplied with a Nut
but are not supplied with a London part.
My Answer: Select spj.j# from spj where spj.p# in (select
p.p# from where not (p.name=’Nut’ AND p.city=’London’))
(5) Print the J#s of projects that are not supplied with a
part that has weight > 17.
My Answer: (Select j# from spj) except select spj.j# from
spj,p where p.weight > 17