25 Query Question
25 Query Question
#########################################################################
Customer Depositor
CUSTOME CUSTOMER_ CUSTOME CUSTOMER_N ACCOUNT_NUMB
R_NAME STREET R_CITY AME ER
Adams Spring Pittsfield Johnson A-101
Brooks Senator Brooklyn Smith A-215
Curry North Rye Hayes A-102
Glenn Sand Hill Woodside Turner A-305
Green Walnut Stamford Johnson A-201
Hayes Main Harrison Jones A-217
Johnson Alma Palo Alto Lindsay A-222
Jones Main Harrison
Smith Main Rye
Turner Putnam Stamford
Williams Nassau Princeton
Account Borrower
ACCOUN CUSTOMER_NA LOAN_NUMBE
T_NUMB BRANCH_ ME R
ER NAME BALANCE Jones L-17
A-101 Downtown 500 Smith L-23
A-215 Mianus 700 Hayes L-15
A-102 Perryridge 400 Jackson L-14
A-305 Round Hill 350 Curry L-93
A-201 Perryridge 900 Smith L-11
A-222 Redwood 700 Williams L-17
A-217 Brighton 750 Adams L-16
Loan Branch
LOAN_NU BRANCH_NA AMOUN BRANCH_N BRANCH_
MBER ME T AME CITY ASSETS
L-17 Downtown 1000 Downtown Brooklyn 900000
L-23 Redwood 2000 Redwood Palo Alto 2100000
L-15 Perryridge 1500 Perryridge Horseneck 1700000
L-14 Downtown 1500 Mianus Horseneck 400200
L-93 Mianus 500 Round Hill Horseneck 8000000
L-11 Round Hill 900 Pownal Bennington 400000
L-16 Perryridge 1300 North Town Rye 3700000
Brighton Brooklyn 7000000
CUSTOMER_NAME CUSTOMER_CITY
Jones Harrison
Smith Rye
Hayes Harrison
Curry Rye
Williams Princeton
Adams Pittsfield
#02. Set of names & cities of customers who have a loan at "Perryridge" branch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME CUSTOMER_CITY
Adams Pittsfield
Hayes Harrison
ACCOUNT_NUMBER BALANCE
A-215 700
A-201 900
A-222 700
A-217 750
#04. Name of customers on streets with names ending in "Hill"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME CUSTOMER_STREET
Glenn Sand Hill
#05. Name of customers with both accounts and loans at "Perryridge" branch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME
Hayes
#06. Names of customers with an account but not a loan at "Perryridge" branch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME
Johnson
#08. Set of names of customers with accounts at a branch where "Hayes" has an account
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME
Hayes
Johnson
#09. Set of names of branch whose assets are greater than the Assets of some branch in
"Brooklyn"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
BRANCH_NAME ASSETS
Redwood 2100000
Perryridge 1700000
Round Hill 8000000
North Town 3700000
Brighton 7000000
#10. Set of names of branch whose assets are greater than the Assets of all branch in
"Brooklyn"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
BRANCH_NAME ASSETS
Round Hill 8000000
#13. Names of branch having at least one account with average account balance
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
BRANCH_NAME AVG(BALANCE)
Round Hill 350
Mianus 700
Perryridge 650
Redwood 700
Brighton 750
Downtown 500
#14. Names of branch having at least one account with size of set of customers having at least
one account at that branch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
BRANCH_NAME COUNT(ACCOUNT_NUMBER)
Round Hill 1
Mianus 1
Perryridge 2
Redwood 1
Brighton 1
Downtown 1
#15. The average balance of all accounts
"""""""""""""""""""""""""""""""""""""""""""
AVG(BALANCE)
614.286
#16. name of branches having at least one account,with average balances of account at each
branch,if that average is above 700
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
BRANCH_NAME AVG(BALANCE)
Brighton 750
#20.Find the customers who have loan between 1500 and 2500
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME
Smith
Hayes
Jackson
#21.Find the customers who live in the city "Rye" and have a loan in the bank
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME
Curry
Smith
#24. Find the customer’s name who borrows the maximum amount
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
CUSTOMER_NAME LOAN_NUMBER AMOUNT
Smith L-23 2000