0% found this document useful (0 votes)
41 views3 pages

RELATIONAL MODEL Exercise in Database Systems

This document describes a banking database schema with tables for branches, customers, accounts, loans, and relationships between them. It then provides 20 exercises involving relational algebra operations like selection, projection, join, set difference to query and manipulate data in the database. Examples include getting customer names with loans over a certain amount, finding customers with accounts but not loans, deleting records that meet certain criteria, and updating records by inserting, deleting, modifying data.

Uploaded by

Malaika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

RELATIONAL MODEL Exercise in Database Systems

This document describes a banking database schema with tables for branches, customers, accounts, loans, and relationships between them. It then provides 20 exercises involving relational algebra operations like selection, projection, join, set difference to query and manipulate data in the database. Examples include getting customer names with loans over a certain amount, finding customers with accounts but not loans, deleting records that meet certain criteria, and updating records by inserting, deleting, modifying data.

Uploaded by

Malaika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

RELATIONAL MODEL LECTURE (Relational Algebra Exercise – Banking)

Consider the following schema for a bank accounts and loan enterprise system.

Branch (branch-no, branch-name, branch-city, assets) Customer (customer-no, name, street,


city)
Account (account-no, branch-no, balance)
Loan (loan-no, branch-no, amount)

Depositor (customer-no, account-no)

Borrower (customer-no, loan-no)


Note: In this example validity of Account’s information is tested with Depositor and validity
of Loan is tested with Borrower. It means there are some Accounts (account-no) that do not
belong to customers, so we cannot consider as active accounts. Same thing is applied for
Loan as well.

1. Get the number, name, city and assets of all Branches in city “Brooklyn”.

2. Get names and addresses of all Customers in city “Princeton”.

3. Get the number, name, city, assets of all Branches.

4. Get a list of customer names who are Borrowers.

5. Get a list of account-no, branch name having branch number “B-25” and balance
greater than 2560. (use Cartesian Product method)

6. Get the list of customer’s name, customer’s city for loan numbers above or same as
“L-15”.
7. Get the list of customer’s name, customer’s city and Depositor’s account number,
who have branch in city “Perryidge”.

8. List the names of all bank customers who have either an account or a loan or both.

9. Find all customers who have an account but not a loan. (use of minus) (Taking out all
elements of 2nd set out of 1st set)

10. Get the list of all customers who have both a loan and an account.

11. Find the names of all customers who have a loan at the branch name “Perryidge”. (use
of Cartesian Products)

12. Find the names of all customers in city “Princeton”, who have a loan at the bank, and
find the amount of the loan as well.

13. Find all customers who have an account at all the branches located in “Brooklyne”.
14. List of customer-no, branch-no and loan amount of all borrower customers who
withdraw loan amount or not.

15. Find the largest account balance in bank. (Use of rename column, cartesian product
and minus).

16. Delete all those customer records from Depositor where customer number is 56475.

17. Delete all accounts at branches located in “Needham”

18. Insert a deposit record for a customer-no 22341 having balance amount of $1200 for
account number A-984 at branch number 2556

19. Give 6% raise to those account holders who have balance amount more than $1000.

20. List of customers’ Customer-no, Address (rename attribute for street) where city is
“Perryridge”.

You might also like