Skip to main content

Subsection 1.3.7 Database Integrity Constraints

Maintaining the integrity and consistency of data in large databases is hard. People make input errors, for example. So most practical database systems exploit a collection of rules that check to make sure that data have not become corrupted. Like other specifications, these rules are written as statements that must be guaranteed to become and remain true.

Problems 1.3.13.

Database integrity constraints can serve multiple purposes, including checking for data errors and checking for policy violations.

(a)

Assume that our corporate Human Relations (HR) database contains the constraint:

If an employee record violates this rule:

  1. It’s almost certainly a data entry error.

  2. There has almost certainly been a policy violation.

  3. Either a data entry error or a policy violation (or both) could have occurred.

Answer.
iii is correct.
Solution.
It’s possible that the employee’s birthdate was entered incorrectly. It’s also possible that someone under 18 was hired

(b)

Assume that our corporate (HR) database contains the constraint:

If an employee record violates this rule:

  1. It’s almost certainly a data entry error.

  2. There has almost certainly been a policy violation.

  3. Either a data entry error or a policy violation (or both) could have occurred.

Answer.
i is correct.
Solution.
Since it’s not possible to hire someone before they’re born, this is almost certainly a data entry error.