Database Reference
In-Depth Information
135
RepNum does not
match any RepNum
value in Rep table
Message indicating you
cannot add a record because
the RepNum is invalid
FIGURE 4-19
Referential integrity violation when attempting to add a record
Deleting a sales rep who currently has customers on file would also violate referential integrity because
the sales rep
s customers would no longer match any sales rep in the Rep table. The DBMS must prevent this
type of deletion and then produce an error message, such as the one shown in Figure 4-20. If sales rep 20
leaves Premiere Products, all of her customers would need to be assigned to other sales reps before her record
could be deleted from the Rep table.
'
Message indicating you
cannot delete sales rep 20
because related customer
records exist
FIGURE 4-20
Referential integrity violation when attempting to delete a record
Legal-Values Integrity
In addition to the two integrity rules defined by Codd, there is a third type of integrity, called legal-values
integrity. Often there is a particular set of values, called the legal-values, that are allowable in a field. Legal-
values integrity is the property that states that no record can exist in the database with a value in the field
other than one of the legal values. For example, at Premiere Products, the legal values for the CreditLimit
field are $5,000, $7,500, $10,000, and $15,000. The DBMS must reject an attempt to enter a record with a
credit limit of $12,500.
Search WWH ::




Custom Search