Part A Create a database called AWESOME and initialize it with 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 Catalog relation lists the prices charged for parts by Suppliers. Write the SQL script to create the tables, including implied foreign keys, and populate it with sample data. Sample data should be minimum 4 records each and able to prove the queries in part B are accurate. (ie Query # 4 requires a supplier with a specific name to be included) Part B  Write the following queries in SQL: Find the pnames of parts supplied by Acme Widget Suppliers and no one else. Find the sids of suppliers who charge more for some part than the average cost of that part (averaged over all the suppliers who supply that part). For each part, find the sname of the supplier who charges the most for that part. Find the sids of suppliers who supply only red parts. Find the sids of suppliers who supply a red part and a green part. Find the sids of suppliers who supply a red part or a green part. For every supplier that only supplies green parts, print the name of the supplier and the total number of parts that she supplies. For every supplier that supplies a green part and a red part, print the name and price of the most expensive part that she supplies.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Part A
Create a database called AWESOME and initialize it with 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 Catalog relation lists the prices charged for parts by Suppliers. Write the SQL script to create the tables, including implied foreign keys, and populate it with sample data. Sample data should be minimum 4 records each and able to prove the queries in part B are accurate. (ie Query # 4 requires a supplier with a specific name to be included)
Part B
 Write the following queries in SQL:
  1. Find the pnames of parts supplied by Acme Widget Suppliers and no one else.
  2. Find the sids of suppliers who charge more for some part than the average cost of that part (averaged over all the suppliers who supply that part).
  3. For each part, find the sname of the supplier who charges the most for that part.
  4. Find the sids of suppliers who supply only red parts.
  5. Find the sids of suppliers who supply a red part and a green part.
  6. Find the sids of suppliers who supply a red part or a green part.
  7. For every supplier that only supplies green parts, print the name of the supplier and the total number of parts that she supplies.
  8. For every supplier that supplies a green part and a red part, print the name and price of the most expensive part that she supplies.
 
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Transaction Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education