Consider the following
Relational database where the primary keys are underlined. Give an expression
in the relational algebra to express each of the following queries:
Branch (branch-name, branch-city, address);
Customer (customer_name, street, city);
Loan (loan-number, person-name, amount);
Borrower (account-number, loan-number);
Account (account-number, branch-name, balance);
Depositor (customer-name, account-number);
i. Find all
customer of bank who have an account but not a loan.
Î customer_name (depositor) - Î customer_name
(borrower)
ii. Find the
names of all customer who lives on the same street and in the same city as
Smith.
iii. Find the
names of all branches with customer who have an account in the bank who live in
Dhaka.
Πbranch_name (σcustomer_city=
“Dhaka” (customer × account × depositor))
iv. Delete all of
Smith’s account records.
depositor ← depositor - σcustomer_name
= “Smith” (depositor)
v. Find all
customer-name, loan-number and loan-amount of the bank where borrower and loan
denote two distinct relation.
Î customer_name, loan_number, amount (borrower
× loan)
No comments:
Post a Comment