Database Reference
In-Depth Information
Figure 10.57. Designating a Deny deletion rule for the relationship between the
EMPLOYEES and ORDERS tables
You always set the deletion rule from the perspective of the parent table because it is the
more important of the two tables within the relationship. Deleting a record in the parent
table will always have some effect on related records in the child table, but deleting a re-
cord in the child table will have no effect on the related record in the parent table. (There
is a specific circumstance in which you might want to establish a Restrict deletion rule for
the child table, and you'll learn about it in Chapter 11 . )
The question you use to determine the deletion rule for a self-referencing relationship is
just slightly different from the one you just used for a dual-table relationship:
When a record in the ( name of parent table ) table is deleted, what
should happen to the foreign key values of the other records that
were related to it?
If you're working with the self-referencing relationship for the EMPLOYEES table, you
could pose the question in this manner:
When a record in the EMPLOYEES table is deleted, what should
happen tothe foreign keyvalues ofthe other records that were re-
lated to it?
Once again, the reply will usually indicate which deletion rule you should use for the rela-
tionship:
You can't delete a record for an employee who's currently man-
aging other employees. (Use a Restrict rule.)
Iftheemployeeyouwanttodeleteisamanager,youcannotdelete
his record until you assign the employees he manages to a differ-
ent manager. (Use the Restrict rule.)
Search WWH ::




Custom Search