Database Administration: The Complete Guide to DBA Practices and Procedures by Craig S. Mullins

Database Administration: The Complete Guide to DBA Practices and Procedures by Craig S. Mullins

Author:Craig S. Mullins [Mullins, Craig S.]
Language: eng
Format: azw3
Publisher: Pearson Education
Published: 2012-10-11T04:00:00+00:00


Figure 13.3. Parent and child tables

Three types of rules can be attached to each referential constraint: an INSERT rule, an UPDATE rule, and a DELETE rule. Let’s see how these rules govern a referential constraint.

Three types of rules can be attached to each referential constraint.

INSERT Rule

The INSERT rule indicates what will happen if you attempt to insert a value into a foreign key column without a corresponding primary key value in the parent table. There are two aspects to the RI INSERT rule:

1. It is never permissible to insert a row into a dependent table with a foreign key value that does not correspond to a primary key value. This is known as the restrict-INSERT rule.

2. Whether actual values must be specified instead of nulls.

For each relationship, the DBA must decide whether the foreign key value(s) must be specified when the row is initially inserted into the table. To determine this, ask the following question: “Does it make sense, in business terms, to know the primary key value in the parent table when adding a dependent row?”

If a foreign key value is specified, it must be equal to one of the values currently in the primary key column of the parent table. This implements the restrict-INSERT rule. If a foreign key value is optional, it can be set to null.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.