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)

Database Systems: Design, Implementation, & Management
12th Edition
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Carlos Coronel, Steven Morris
Chapter7: Introduction To Structured Query Language (sql)
Section: Chapter Questions
Problem 13P: Write the two SQL command sequences required to: a.Create a temporary table named TEMP_1 whose...
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 for which there is some supplier.
  2. Find the snames of suppliers who supply every part.
  3. Find the snames of suppliers who supply every red part.
  4. Find the pnames of parts supplied by Acme Widget Suppliers and no one else.
  5. 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).
  6. For each part, find the sname of the supplier who charges the most for that part.
  7. Find the sids of suppliers who supply only red parts.
  8. Find the sids of suppliers who supply a red part and a green part.
  9. Find the sids of suppliers who supply a red part or a green part.
  10. For every supplier that only supplies green parts, print the name of the supplier and the total number of parts that she supplies.
  11. 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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Dataset
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 Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning