- Integrity constraints
Integrity constraints are used to ensure accuracy and consistency of data in a
relational database . Data integrity is handled in a relational database through the concept ofreferential integrity . There are many types of integrity constraints that play a role in referential integrity.Codd, initially defined two sets of constraints, but in his second version of the relational model, he came up with five integrity constraints:
*Entity integrity
*Referential Integrity
*Domain Integrity A domain defines the possible values of an attribute. Domain Integrity rules govern these values. In a database system, the domain integrity is defined by:The datatype and the length The NULL value acceptance The allowable values, through techniques like constraints or rules The default value For example, if you define the attribute of Age, of an Employee entity, is an integer, the value of every instance of that attribute must always be numeric and an integer.
If you also define that this attribute must always be positive, the a negative value is forbidden.
The value of this attribute being mandatory indicates that the attribute can be NULL.
All of these characteristics form the domain integrity of this attribute.
This type of data integrity warrants the following: the identity and purpose of a field is clear and all of the tables in which it appears are properly identified; field definitions are consistent throughout the database; the values of a field are consistent and valid; and the types of modifications, comparisons and operators that can be applied to the values in the field are clearly identified.
*
Column Integrity
*User Defined Integrity
Wikimedia Foundation. 2010.