In: Computer Science
Consider the following schema:
Suppliers(sid, sname, address)
Parts(pid, pname, color)
Catalog(sid, pid, cost)
write the following queries in SQL:
* Find the names of all suppliers who supply a green part.
*Find the names of all suppliers who are from Illinois.
*Find the names of all suppliers who sell a red part costing less than $100.
*Find the names and colors of all parts that are green or red.
In writing these queries you may make the following assumptions:
a. Each part has
only one color.
b. A cost field is a real number with two decimal places (e.g.,
100.25, 93.00).
c. The sid field in Suppliers and the sid field in Catalog refer to
the same field.
d. The pid field in Parts and the
pid field in Catalog refer to the same field.
Q1 Query 1
Explaination for above query
Now you can also understand using algebra
Q2 Query 2
Q3 Query 3
Q 4 Query 4