Referential Integrity
1. A PARENR KEY value must be UNIQUE, and can’t be NULL.
2. A FOREIGN KEY value must match a PARENT KEY or be NULL
3. DB2 enforcement of referential constraints:
l For FOREIGN KEY
--INSERT/UPDATE/LOAD
Must match PARENT KEY or be NULL
--Delete
No constraint
l For PARENT KEY
--INSERT
No constraint
--Delete
When delete a parent key, what should be done to matching foreign keys?
* CASCADE
* SET NULL
* RESTRICT/NO ACTION
--UPDATE/LOAD
When there is a foreign key matchs the updating parent key
* RESTRICT
When there is a foreign key matchs the updated parent key
* NO ACTION
本文详细介绍了数据库中参照完整性约束的概念,包括父键与外键的定义及其约束条件。文章探讨了DB2如何实施参照完整性的规则,并解释了在不同操作下父键与外键之间的相互作用。
858

被折叠的 条评论
为什么被折叠?



