Last Updated: July 14, 2017
·
773
· napster

sql query of relational schema

schema:
Bank (Code, Name, Addr)
BankBranch (Code, BranchNo, Addr)
AccountInfo (AcctNo, Balance, Type, Code, BranchNo)
Loan
Info (LoanNo, Amount, Type, Code, BranchNo)
Customer (SSN, Name, Addr, Phone)
CustomerAccount (SSN, AccountNo)
Customer
Loan (SSN, LoanNo)

queries to be solved:
a. List the Addresses (as BranchAddress) of all Branches of “Alfalah” Bank. (Use Inner Query in SQL)
b. For each Bank, list the details of the branch containing the account with the maximum balance across the whole bank.
c. List the customer names who have at least 3 accounts in at least 2 the branches of “Standard Chartered” Bank.
d. List the customer SSNs who either took a loan or have an account in any bank branch.
e. Show the names of all customers, along with the total loan taken by these customers. (You should display the customer name even if the customer has not taken any loan).