|
|
select distinct sname from supplier, spj, part, proj where supplier.snum = spj.snum and part.pnum = spj.pnum and proj.jnum = spj.jnum and proj.city = 'Atlanta' and part.color = 'Red' |
select sname from supplier, spj, part, proj where supplier.snum = spj.snum and part.pnum = spj.pnum and proj.jnum = spj.jnum and proj.city = 'Atlanta' and part.color = 'Red' group by supplier.sname having count(proj.jnum) >= 4 |
select sname from supplier where snum not in ( select distinct snum from spj, proj where proj.jnum = spj.jnum and proj.city = 'Paris' ) |
The answer has the following form:
sname pname total shipped (it's OK to have a diff title) ---------- ---------- --------------------------------- Adams Bolt 300 Adams Cam 1000 Blake Screw 700 Bond Cam 100 ... |
select sname, pname, sum(qty) from spj, supplier, part where spj.snum = supplier.snum and spj.pnum = part.pnum group by sname, pname |
select sname from spj, supplier where spj.snum = supplier.snum group by supplier.sname having count(*) > (select count(*) from spj, supplier where spj.snum = supplier.snum and sname = 'Newton') |