How to delete the record from the base table with foreign key mapping

Database
Enthusiast

How to delete the record from the base table with foreign key mapping

Hi,

Consider a table A with 3 columns. 1st column is the primary key, 2nd column is a foreign key mapped from table B. Now if some deletions happen in table A, certainly some values for column 2 which is a foreign key are deleted. Is there any direct way to delete these values from table B as well without joining with Table A??

If we delete value in Table A it should refelect in Table B as well. Please let me know if this is possible.

2 REPLIES
Junior Supporter

Re: How to delete the record from the base table with foreign key mapping

There is not ON DELETE CASCADE. You must do it explicity (join, SP, Trigger...)

Cheers.

Carlos.

Junior Supporter

Re: How to delete the record from the base table with foreign key mapping

I stand corrected: you cannot use a trigger to delete cascade:

"BEFORE triggers cannot have data-changing statements as their triggered action (triggered SQL statements)."

Cheers.

Carlos.