DBMS Assignment 2
DBMS Assignment 2
10. Consider the employee database of Figure 2.17. Give an expression in the relational algebra to
express each of the following queries: branch(branch name, bran h city, assets) Customer
(ID, customer name, customer street, customer city) loan (loan number, bran h name,
amount) borrower (ID, loan number) amount (amount number, bran h name, balance)
depositor (ID, amount number)
The key fields are underlined, and the domain of each field is listed after the field name. Therefore sid is
the key for Suppliers, pid is the key for Parts, and sid and pid together formthe key for Catalog. The
Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in relational
algebra.
a. Find the Supplier names of the suppliers who supply a red part that costs less than 100
b. dollars.
c. Find the Supplier names of the suppliers who supply a red part that costs less than 100 dollars
and a green part that costs less than 100 dollars.
d. Find the Supplier sid of the suppliers who supply a red part that costs less than 100 dollars
and a green part that costs less than 100 dollars.
e. Find the Supplier names of the suppliers who supply a red part that costs less than 100 dollars
and a green part that costs less than 100 dollars.
12. For the following relation schema: Give an expression in SQL for each of the following queries:
employee (employee-name, street, city), works (employee-name, companyname, salary), company
(company-name, city), manages (employee-name, managername)
a) Find the names, street address, and cities of residence for all employees who work for 'First Bank
Corporation' and earn more than $10,000
b) Find the names of all employees in the database who live in the same cities as the companies for which
they work
c) Find the names of all employees in the database who live in the same cities and on the same streets as
do their managers.