Database Integrity
Database Integrity is the preservation of data correctly and implies the process of keeping the database from accidental deletion. Integrity checks the performed at the data entry level itself by checking that data values conform to the certain specified rule.
Integrity Constraint:
Relational Database model specifies three types of Integrity Constraint.
1. Entity Integrity Constraint
2. Referential Integrity Constraint
3. Domain Integrity Constraint
Entity Integrity Constraint:
Entity Integrity constraint specifies that entities (rows) should be distinguishable that means is each entity must be unique. Primary key values perform this unique identification function. No prime attribute (component of a primary key) value would be null, because if two or more entities have nulls in their primary key value, they can’t be distinguished.
Referential Integrity Constraint:
Referential Integrity Constraint ensures that a value that appears in one relation for an attribute should also appear for a matching attribute in another relationship if two relations are related to each other on this common attribute. It is concerned with the concept of the foreign key. The domain of a foreign key is those of the primary key of another relation.
Domain Integrity Constraint:
Domain Integrity Constraint specifies that the value of an attribute that says A, must be from the domain that says Domain(A). A domain is a set of atomic values.