Consider the bank database in Figure 1, where the primary keys are underlined. Each branch might have many loans or accounts, associated with borrowers or depositors, respectively. Construct the following SQL queries for this relational database. 1. Find the name of each branch that has at least one customer who has an account in the bank and who lives in the "Harrison" city. Make sure each branch name only appears once. < 2. Find the ID of each customer who lives on the same street and in the same city as customer "12345". (1) Please use "tuple variables".< (2) Please use "derived relations" or "with". 3. Find the ID of each customer of the bank who has an account but not a loan. < 4. Find the total sum of all loan amounts for each branch in the bank.

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter2: Database Design Fundamentals
Section: Chapter Questions
Problem 11RQ
icon
Related questions
Question
branch(branchhame, branch+citysassets}
customer (HD, Customer name, customer street, customer city)
loan loan number branch_name, amounty
borrower(ID; loan_number
account (account_number, branch name, balance)e
depositor (HDs account number)-
Figure le
Consider the bank database in Figure 1, where the primary keys are underlined. Each
branch might have many loans or accounts, associated with borrowers or depositors,
respectively. Construct the following SQL queries for this relational database.
1. Find the name of each branch that has at least one customer who has an account in
the bank and who lives in the "Harrison" city. Make sure each branch name only
appears once.
2. Find the ID of each customer who lives on the same street and in the same city as
customer "12345".
(1) Please use "tuple variables". e
(2) Please use "derived relations" or “with".
3. Find the ID of each customer of the bank who has an account but not a loan.
4. Find the total sum of all loan amounts for each branch in the bank. e
Transcribed Image Text:branch(branchhame, branch+citysassets} customer (HD, Customer name, customer street, customer city) loan loan number branch_name, amounty borrower(ID; loan_number account (account_number, branch name, balance)e depositor (HDs account number)- Figure le Consider the bank database in Figure 1, where the primary keys are underlined. Each branch might have many loans or accounts, associated with borrowers or depositors, respectively. Construct the following SQL queries for this relational database. 1. Find the name of each branch that has at least one customer who has an account in the bank and who lives in the "Harrison" city. Make sure each branch name only appears once. 2. Find the ID of each customer who lives on the same street and in the same city as customer "12345". (1) Please use "tuple variables". e (2) Please use "derived relations" or “with". 3. Find the ID of each customer of the bank who has an account but not a loan. 4. Find the total sum of all loan amounts for each branch in the bank. e
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Dataset
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr