


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



21:124 / 22C:144, Spring 2002 Homework Assignment #3 Solutions
For the following database schema,
Solution 3 Get all supplier ID / part ID / project ID triples such that the indicated supplier, part and project are all colocated (i.e., all in the same city). (DRC, RA) DRC: { <s,p,r> | $ c1 <s, sn, st, c1> e Supplier Ÿ $ c2 <p, pn,, col, wt, c2> e Part Ÿ $ c3 <r, rn, c3> e Project Ÿ c1=c2 Ÿ c2=c3 } RA: P Supplier.supplierID, Part.partID, Project.projectID ( s Supplier.city = Part.cityWhereStored Ÿ Part.cityWhereStored = Project.city (Supplier x Part x Project)) Solution 4 Get full details for parts supplied by Chicago suppliers. (RA, TRC). RA: P Part.partID, Part.partName, Part.color, Part.weight, Part.cityWhereStored ( s Supplier.city = ‘Chicago’ ( SPJ join Supplier join Part))
TRC: { t | $ s e Supplier (s[city] = ‘Chicago’ Ÿ $ u e SPJ (u[supplierID] = s[supplierID] Ÿ $ p e Parts( p[partID] = u[partID] Ÿ t[partID] = p[partID] Ÿ t[partName] = p[partName] Ÿ t[color] = p[color] Ÿ t[weight] = p[weight] Ÿ t[cityWhereStored] = p[cityWhereStored] ))) }
Solution 5 Get supplier IDs for suppliers with a lower status than supplier 42. (TRC, DRC) TRC: { t | $ s e Supplier ( s[supplierID] = ‘42’ Ÿ $ u e Supplier (t[supplierID] = u[supplierID] Ÿ u[status] < s[status] )) }
Solution 8 Get supplier IDs for suppliers who supply all projects. (TRC, DRC) TRC { t | " r e Project fi $ s e SPJ ( s[projectID] = p[projectID] Ÿ t[supplierID] = s[supplierID] ) }
DRC {