Скачиваний:
101
Добавлен:
30.04.2013
Размер:
1.64 Mб
Скачать

Referential Integrity

RI, Cardinality, and Non-Identifying Relationships

If the business decides that PROJECT-EMPLOYEEs are not existence or identification-dependent on PROJECT, you can change the relationship between PROJECT and PROJECT-EMPLOYEE to optional, non-identifying. In this type of relationship, the referential integrity options are very different.

Referential Integrity for a Non-Identifying Relationship

Because a foreign key contributed across a non-identifying relationship is allowed to be NULL, one of the referential integrity options you could specify for PARENT DELETE is "set null." Set null indicates that if an instance of PROJECT is deleted, then any foreign key inherited from PROJECT in a related instance in PROJECT-EMPLOYEE should be set to NULL. The delete does not cascade as in our previous example, and it is not prohibited (as in restrict). The advantage of this approach is that you can preserve the information about the PROJECTEMPLOYEE while effectively breaking the connection between the PROJECTEMPLOYEE and PROJECT.

Decisions to use cascade or set null reflect business decisions about maintaining the “historical” knowledge of relationships represented by the foreign keys.

Refining Model Relationships 6–9