Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Consider the following database schema: Suppliers(sid; sname; city), P arts(p

ID: 440880 • Letter: 2

Question

2. Consider the following database schema: Suppliers(sid; sname; city), P arts(pid; pname; color), Catalog(sid; pid; price), where sid is the identifier (primary key) of a supplier, sname the supplier's name, and city the supplier's city; pid is the part identifier (primary key), pname its name and color its color, and a tuple (s; p; c) in Catalog means that supplier with sid s supplies part with pid p at price c (so sid and pid in Catalog are foreign keys). The same part may be supplied by different suppliers at different cost; a supplier may supply different parts. Write the following queries in Relational Algebra. (a) Find the names of suppliers from Louisville who supply some blue part for less than $10. (b) Find all the prices for part with name 'hex-screw'. (c) Find the names of suppliers who supply at least two parts. (d) Find the pid of parts supplied by at least two suppliers at different prices. (e) Find the pid of parts that have only one supplier. (f) (*) Find the suppliers that supply only red parts.

Explanation / Answer

Please Rate me to get rewarded. SUPPLIERS (sid : integer, sname : string, address : string) PARTS (pid : integer, pname : string, color : string) CATALOG (sid : integer, pid : integer, cost : real) A) Step 1: We First find The Pids of parts that are Green in color from PARTS table Step 2:We compute the natural join of this with CATALOG table from this we project pid for which gives ids cost