(The rules that should not be violated while performing operation on database)
Integrity constraints ensure that changes made to the database by authorized users do not result in a loss of data consistency. Thus, integrity constraints guard against accidental damage to the database.
Simple forms of Constraints are Key Constraints Â and form of a Relationships Constraints.
The relational data model includes several types of constraints, or business rules, whose purpose is to facilitate maintaining the accuracy and integrity of data in the database. The major types of integrity constraints are domain constraints, entity integrity, referential integrity.
Database designer can specify integrity constraints that are enforced by the DBMS. A constraint is rule that cannot be violated by database users (ie. Also called business rule).
(controlling data integrity)
For many DBMS data integrity constraints ( ie. Control on the possible value a field can assume) can be build into the physical structures of the fields. The data type enforce one form of data integrity control. Since it may limit the type of data (for eg:- numeric or character, data type) and length of a field value. Some typical integrity constraints controls that a DBMS may support are:-
Default Value:- A default is a value a field will assume unless a user enters an explicit value. For an instance of that field. Assigning a default value to a field can reduce a data entry time since entry of a value can be skipped and it can also help to reduce data entry errors for that most common value.
Range Control:- A range control limits the set of permitted values, a field may assume. The range may be a numeric lower to upper bound or a set of specify values. Range control must be used with caution since the limits of the range may change overtime.
NULL value control:- Each primary key must have an integrity control that prohibits null value. Any other required fields may also have null value control placed on it if that is the policy of the organization.
Referential Integrity:- Referential Integrity on a field is a form of range control in which the value of that field must exist as the value in some field in another row of the same or different table. ie. The range of legitimate values comes from the dynamic contents of the field in a database table, not from pre-specified setup value.
An integrity constraint that the value of an attribute in one relation depends on the value of a primary key in the same or another relations.