The story about referential integrity in DB2 database. Given the most popular points on referential integrity.
- When inserting foreign key row it disallows when there is no corresponding Primary key.
- New primary key row can be inserted as long as it is unique
- When updating foreign key value, it checks if corresponding primary key is available
- If a primary key has dependent foreign key Db2 does not allow to update. we can make by setting foreign key to zeros or we can delete all foreign key values.
- Deleting a row of foreign key is permitted.
- When deleting primary key: The below are the constraints: CASCADE, RESTRICT, SET NULL, NO ACTION