Question: Consider the following schema: SUPPLIERS (SID : integer, SNAME : string, ADDRESS : string) PARTS (PID : integer, PNAME : string, COLOR : string) CATALOG

Consider the following schema:

SUPPLIERS (SID : integer, SNAME : string, ADDRESS : string) PARTS (PID : integer, PNAME : string, COLOR : string) CATALOG (SID : integer, PID : integer, COST : real) The key fields are underlined, and the domain of each field is listed after the field name. Thus, SID is the key for SUPPLIERS, PID is the key for PARTS, and SID and PID together form the key for CATALOG. The CATALOG relation lists the prices charged for parts by suppliers. CATALOG.SID is a foreign key referring to SUPPLIERS.SID and CATALOG.PID is a foreign key referring to PARTS.PID.

Write the following queries in SQL:

1. For every supplier that supplies a green part and a red part, print her SID and the PID, the name and the price of the most expensive parts that she supplies.

2. List the PID, PNAME and average cost of all parts.

3. Find the average cost of parts supplied by suppliers named 'Yosemite Sham'.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!