Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have 4 relations/tables with their attributes listed below them, which are as

ID: 3606077 • Letter: I

Question

I have 4 relations/tables with their attributes listed below them, which are as follows:

Account (table)

account_number

branch_name

balance

Depositor (table)

customer_name

account_balance

Loan(table)

loan_number

branch_name

amount

Borrower(table)

customer_name

loan_number

I need to delete the records of all accounts with balances below the average balance at the bank.

SELECT avg (balance)

FROM account;

This gives us an average balance of $10,580

DELETE FROM account

WHERE balance > 10580;

When I run this sql query I get a error message that reads:

ERROR at line 1:

ORA-02292: integrity constraint violated - child record found

I would think that deleting tuples from the Account table would mess with the records from the Depositor table.

I'm not sure how to fix this problem so I can delete the records from the account table that are below the banks average balance.

Explanation / Answer

The issue may be having account_number in depositer table.When you delete account_number from Account table,

account_number column in depositer table( foreign key ) cannot be linked to primary key ( account_number ) in

Account table

YOu can use on delete cascade or on delete null while creating foreign key constraints