Question: Write a SQL trigger (in PostgresSQL) to carry out the following action: On delete of an account, for each customer-owner of the account, check if

Write a SQL trigger (in PostgresSQL) to carry out the following action:

On delete of an account, for each customer-owner of the account, check if the owner has any remaining accounts, and if she does not, delete her from the depositor relation. You must submit both your trigger function, and your trigger definition.

Use this for TRIGGER DEFINTION explanation (will submit new for trigger function)

Database Schema:

branch ( b ranch_name, branch_city, assets )

customer ( I D, customer_name, customer_street, customer_city )

loan ( l oan_number, branch_name, amount )

borrower ( I D, l oan_number )

account ( a ccount_number, branch_name, balance )

depositor ( I D, a ccount_number )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!