Data Integrity: Data integrity refers to the correctness and consistency of data. It is another form of database protection or security, security involves protecting the data from unauthorized operations, while integrity is concerned with the quality of data itself. The data integrity plays an important role in RDBMS, in which multiple users access the data from database.
Integrity is usually expressed in terms of the certain constraints. These are the consistency rules that can be applied to database so that the correct data can be entered into the database. The constraints may be applied to individual data items within a single record or they may be applied to relationships between records of the same file of organization. Integrity rules\constraints check the data that is entered or modified into the database.
The important data integrity rules are
- Entity Integrity
- Domain Integrity
- Referential Integrity
The entity integrity constraints states that in a relation no primary key value can have a null value. Entity integrity constraints is also referred to as uniqueness constraints. By definition, a primary key is used to identify tuples uniquely. If two or more tuples have null values in the primary key attribute, then you cannot identify tuples uniquely.
You can specify a set of values that can be assigned to an attribute. Domain integrity constraints is specified on the column of a relation, so that correct values can be entered in the column for each record.
The referential integrity constraint is specified between two relations and is used to maintain the consistency among tuples of two relations of same data file in the same organization. Referential integrity states that if a foreign key exist in a relation, then the foreign key value must match the primary key value of some tuple in its home relation or the foreign key value must be completely null.