Q2 soln - Exercises • Find the names of suppliers who supply some red part Suppliers sid integer sname string address string Parts pid integer

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Exercises • Find the names of suppliers who supply some red part. Suppliers( sid: integer, sname: string, address: string) Parts( pid: integer, pname: string, color: string) Catalog( sid: integer, pid: integer, cost: real) SELECT S.sname FROM Suppliers S, Parts P, Catalog C WHERE P.color=’red’ AND C.pid=P.pid AND C.sid=S.sid Exercises • Find pairs of sids such that the supplier with the first sid charges more for some part than the supplier with the second sid. Suppliers( sid: integer, sname: string, address: string) Parts( pid: integer, pname: string, color: string) Catalog( sid: integer, pid: integer, cost: real) SELECT C1.sid, C2.sid FROM Catalog C1, Catalog C2 WHERE C1.pid = C2.pid AND C1.sid = C2.sid AND C1.cost > C2.cost Exercises • Find the sids of suppliers who supply some red part or are at 221 Packer Street. Suppliers( sid: integer, sname: string, address: string) Parts( pid: integer, pname: string, color: string) Catalog( sid: integer, pid: integer, cost: real) SELECT S.sid FROM Suppliers S WHERE S.address = ‘221 Packer street’ OR S.sid IN (SELECT C.sid FROM Parts P, Catalog C WHERE P.color=’red’ AND P.pid = C.pid ) Exercises...
View Full Document

This note was uploaded on 02/27/2010 for the course ECE 544 taught by Professor Ray during the Spring '10 term at Rutgers.

Page1 / 11

Q2 soln - Exercises • Find the names of suppliers who supply some red part Suppliers sid integer sname string address string Parts pid integer

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online