Problem

Exercise 5.2 Consider the following schema:Suppliers(sid: integer, sname: string, address:...

Exercise 5.2 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 Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in SQL:

  1. Find the priames 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 priames 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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 5