Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following schema: SUPPLIERS (SID: integer, SNAME: string, ADDRESS: string) PARTS (PID: integer, PNAME :string, COLOR: string) CATALOG (SID: integer, PID: integer, COST:
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 a. List the average costs of parts of different colors (average cost of red parts, average cost of blue parts, etc.). b. The supplier with SID 10 bought over the business of the supplier with SID 12. So now supplier 10 supplies both of their parts, and supplier 12 is gone. Write one or more queries to reflect this fact in the database. c. List the SIDS and names of suppliers, and the number of parts they supply, sorted in the descending order of the number of parts they supply d. List the SID and names of all suppliers who supply no part costing more than 1000. A supplier must not appear more than once in the list. e. List the SIDS of all suppliers who supply only red parts and no other colored parts.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started