Consider the following schema:
Suppliers(sid: integer, sname: string, address: string, country: string)
Parts(pid: integer, pname: string, color: string, weight: real)
Catalog(sid: integer, pid: integer, cost: real)
The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries
1. Write SQL statements to create these tables with the proper primary key and foreign
2. Find the snames of all Chinese suppliers
3. Find the pnames of parts supplied by American suppliers
4. Find the pnames of parts for which there is some supplier.
5. Find the pnames of green parts that are not supplied by Italian suppliers.
6. Find the snames of suppliers who supply every part.
7. Find the snames of suppliers who supply every red part.
8. Find the pnames of parts supplied by Acme Widget Suppliers and no one else.
9. 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).
10.For each part, find the sname of the supplier who charges the most for that part.
11. Find the sids of suppliers who supply only red parts.
12.Find the sids of suppliers who supply a red part and a green part.
13.Find the sids of suppliers who supply a red part or a green part.
14.Find the average weight of red parts for suppliers from each country that has at least 2
15.For every supplier that only supplies green parts, print the name of the supplier and the
total number of parts that she supplies.
16.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.
Recently Asked Questions
- The Nurse as Advocate Whether nurses are advocating for their patients, health care, and/or policies that improve people's lives, the advocacy processes have
- Nurses as Change Agents in the Community The discussion assignment provides a forum for discussing relevant topics for this week on the basis of the course
- This is the topic: Pollution: Technology solution to oil spills and other pollution to water; Outline major ethical concerns. What are the key ethical concerns