Consider the following schema:
Distributor (d-id: numeric, d-name: varchar, address:
varchar)
Item (i-id: numeric, i-name: varchar, color: varchar)
Inventory (d-id: numeric, i-id: numeric, cost: numeric, instock:
numeric)
Where d-id is the distributor's id (primary key in Distributor),
i-id is the item's id (primary key in Item), and d-id
together with i-id is the primary key of Inventory. The Inventory
relation lists the prices charged for items by
distributors.
Write the following queries using relational algebra:
1. Find the names of distributors who sell some red item.
2. Find the d-ids of distributors who sell some blue or yellow
item.
3. Find the d-ids of distributors who sell some blue item or are at
301 Main Street.
4. Find the d-ids of distributors who sell some blue item and some
yellow item.
5. Find the d-ids of distributors who sell every item.
6. Find the d-ids of distributors who sell every blue item.
7. Find the d-ids of distributors who sell every blue or yellow
item.
8. Find the d-ids of distributors who sell every blue item or sell
every yellow item.
Get Answers For Free
Most questions answered within 1 hours.