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 FUNCTION explanation (will submit new for trigger definition)
Database Schema:
branch ( branch_name, branch_city, assets )
customer ( ID, customer_name, customer_street, customer_city )
loan ( loan_number, branch_name, amount ) borrower ( ID, loan_number )
account ( account_number, branch_name, balance )
depositor ( ID, a ccount_number )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
