What are the different ways to maintain data integrity in child table when the record is deleted in parent table?


When two tables are connected with Foreign key and data in the parent table is deleted, for which record exists in child table too, then followings are the ways to maintain data integrity −

On Delete Cascade

This option will remove the record from child table too if that value of the foreign key is deleted from the main table.

On Delete Null

 This option will set all the values in that record of child table as NULL, for which the value of the foreign key is deleted from the main table.

Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician

Updated on: 19-Jun-2020

235 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements