create table branch(branch_name varchar(30) primary key, branch_city varchar(30), assets varchar(60) ); create table customer(ID_number integer primary key, customer_name varchar(30), customer_street varchar(40), customer_city varchar(40) ); create table loan(loan_number integer primary key, branch_name varchar(30),amount integer, foreign key(branch_name) references branch(branch_name) ); create table borrower(ID_number integer primary key, loan_number integer , foreign key(loan_number) references loan(loan_number) ); create table account(account_number integer primary key, branch_name varchar(30), balance integer , foreign key(branch_name) references branch(branch_name) ); create table depositor(ID_number integer primary key, account_number int , foreign key(account_number) references account(account_number) ); SELECT * FROM branch, customer,loan,borrower, account, depositor; 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’. Include customer ‘12345’ in your query results. 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”.

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
Related questions
Question

create table branch(branch_name varchar(30) primary key, branch_city varchar(30), assets varchar(60) );
create table customer(ID_number integer primary key, customer_name varchar(30), customer_street varchar(40), customer_city varchar(40) );
create table loan(loan_number integer primary key, branch_name varchar(30),amount integer, foreign key(branch_name) references branch(branch_name) );
create table borrower(ID_number integer primary key, loan_number integer , foreign key(loan_number) references loan(loan_number) );
create table account(account_number integer primary key, branch_name varchar(30), balance integer , foreign key(branch_name)
references branch(branch_name) );
create table depositor(ID_number integer primary key, account_number int , foreign key(account_number) references account(account_number) );
SELECT * FROM branch, customer,loan,borrower, account, depositor;

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’. Include customer ‘12345’ in your query
results.
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”.
3. Consider the bank database schema given in question (2). Write a SQL trigger to carry
out the following action: If an account is deleted, then write a trigger to delete the
dependent tuple(s) from the depositor table for every owner of the deleted account. Note
that there may be jointly-owned bank accounts. In other words, you are to write a trigger
that performs the exact action of an ON DELETE CASCADE clause of a FOREIGN
KEY CONSTRAINT. You must submit both your trigger function definition, and your
trigger definition. You must name your trigger function

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Single Table
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
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage