Professional Documents
Culture Documents
1) Consider the following schema, where the key field(s) are underlined (e.g. sid is the key
for Supplier), and the domain of each field is listed after the italicized field name. The
Catalog relation lists the prices charged for parts by Suppliers. Write the following queries
in relational algebra. (2 pts. each)
1.1) Find the sids of suppliers who supply some green part.
π sid (( π pid σ color='green' Parts) ⨝ Catalog)
1.2) Find the sids of suppliers who supply some red part or are located at ‘122B Baker St.’
(π sid ((π pid σ color='red' Parts) ⨝ Catalog)) ∪ (π sid σ address='122B Baker St.'
Suppliers)
1.3) Find the sids of suppliers who supply every purple part. (Hint: use division)
(π sid, pid Catalog)/(π pid σ color='purple' Parts)
2) Consider the Supplier-Parts-Catalog schema from the previous question. State what the
following queries compute. (2 pts. each)
Find the names of the suppliers who supply a red part that costs less than $100.
Find the sids of the suppliers who supply a red part that costs less than $100 AND a
green part that costs less than $100.