Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the bank database schema as given below: branch(branch_name, branch_city, assets) customer(customer_name, customer_street, customer_city) loan(loan_number, branch_name, amount) borrower(customer_name, loan_number) account(account_number, branch_name, balance) depositor(customer_name, account_number) Let

Consider the bank database schema as given below:

branch(branch_name, branch_city, assets) customer(customer_name, customer_street, customer_city) loan(loan_number, branch_name, amount) borrower(customer_name, loan_number) account(account_number, branch_name, balance) depositor(customer_name, account_number)

Let us define a view branch_cust as follows:

create view branch cust as select branch_name, customer_name from depositor, account where depositor.account_number = account.account_number

Suppose that the view is materialized; i.e., the view is computed and stored.

a. Write an SQL trigger to maintain the view, i.e., to keep it up to date on insertions to and deletions from depositor or account. Do not bother about updates.

b. Write an SQL trigger to carry out the following action: On delete of an account, for each owner of the account, check if the owner has any remaining accounts, and if he/she does not, delete her from the depositor relation.

Expected Solution: You need to paste the SQL commands for each step.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions