From this schema: CREATE TABLE branch ( ID int(10) ,branch_name varchar(25) NOT NULL , branch_city varchar(15), assets vrachar(20), PRIMARY KEY (ID ,branch_name) ); CREATE TABLE customer ( ID int(10) , customer_name varchar(25), customer_street vrchar(30), customer_city varchar(20), PRIMARY KEY (ID) ); CREATE TABLE loan ( loan_number int(15) , branch_name varchar (25) , amount double(10,2) CHECK (amount >1000), PRIMARY KEY (loan_number), FOREIGN KEY( branch_name) REFERENCES branch(branch_name) ON DELETE CASCADE ); CREATE TABLE borrower ( ID int(20) , loan_number int(15), PRIMARY KEY (ID), FORIEGN KEY (loan_number) REFERENCES loan ( loan_number) ON UPDATE CASCADE ); CREATE TABLE account ( ID int(20) ,account_number int(20) , branch_name varchar(25) , balance double(10,2) DEFAULT 0.00 , PRIMARY KEY (ID, account_number), FOREIGN KEY(branch_name) REFERENCES branch(branch_name)); CREATE TABLE depositor ( ID int(20) , account_number int(20), PRIMARY KEY(ID ), FOREIGN KEY (account_number) REFERENCES account(account_number)); Answer the following questions: a. Write a query to find the ID and customer name of each customer at the bank who only has a loan at the bank, and no account. b. Write a query to find the ID and customer name of each customer who lives on the same street and in the same city as customer ‘12345’. c. Write a query to find the name of each branch that has at least one customer who has an account in the bank and who lives in “Harrison”. d. Write a query to find each customer who has an account at every branch located in “Brooklyn”.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

From this schema:

CREATE TABLE branch ( ID int(10) ,branch_name varchar(25) NOT NULL , branch_city varchar(15), assets vrachar(20), PRIMARY KEY (ID ,branch_name) );

CREATE TABLE customer ( ID int(10) , customer_name varchar(25), customer_street vrchar(30), customer_city varchar(20), PRIMARY KEY (ID) );

CREATE TABLE loan ( loan_number int(15) , branch_name varchar (25) , amount double(10,2) CHECK (amount >1000), PRIMARY KEY (loan_number), FOREIGN KEY( branch_name) REFERENCES branch(branch_name) ON DELETE CASCADE );

CREATE TABLE borrower ( ID int(20) , loan_number int(15), PRIMARY KEY (ID), FORIEGN KEY (loan_number) REFERENCES loan ( loan_number) ON UPDATE CASCADE );

CREATE TABLE account ( ID int(20) ,account_number int(20) , branch_name varchar(25) , balance double(10,2) DEFAULT 0.00 , PRIMARY KEY (ID, account_number), FOREIGN KEY(branch_name) REFERENCES branch(branch_name));

CREATE TABLE depositor ( ID int(20) , account_number int(20), PRIMARY KEY(ID ), FOREIGN KEY (account_number) REFERENCES account(account_number));

Answer the following questions:

a. Write a query to find the ID and customer name of each customer at the bank who only has a loan at the bank, and no account.
b. Write a query to find the ID and customer name of each customer who lives on the same street and in the same city as customer ‘12345’.
c. Write a query to find the name of each branch that has at least one customer who has an account in the bank and who lives in “Harrison”.
d. Write a query to find each customer who has an account at every branch located in “Brooklyn”.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
SQL Query
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education