Database Reference
In-Depth Information
this rule in the most effective manner possible when you implement the database in your
RDBMS.
Here's an important point to note: When you determine that a rule will be violated when
you attempt to delete a record, you must alter the current deletion rule for the relationship
accordingly or add a new deletion rule to the relationship.
You learned in Chapter 10 , “ Table Relationships , ” that you don't need to worry about de-
leting records in the child table of a relationship because there can be no adverse effects
fromdoingso.Wemustnowamendthisassertionbystatingthatanexceptionoccurswhen
deleting a record in the child table would violate a required business rule. You handle this
exception by establishing a Restrict deletion rule for the child table. Make absolutely cer-
tain that you keep this in mind as you're determining when a rule will be tested.
The new business rule for the dance studio database will be tested when you attempt to
insert a record into the INSTRUCTOR CLASSES table; you can associate a maximum of
onlyeightrecordswithaparticularinstructor.Therulewillalsobetestedwhenyouattempt
to delete a record from the INSTRUCTOR CLASSES table; each instructor must be asso-
ciatedwithatleastoneclass.Asaresult,youmustestablishaRestrictdeletionruleforthis
table. Figure 11.11 shows the modifications you've made to this relationship's diagram.
Figure 11.11. Establishing a Restrict deletion rule for the INSTRUCTOR CLASSES
table to support the new business rule
Search WWH ::




Custom Search