Two Types of Data Integrity – Data Integrity and Normalization

what is data integrity? What are two types of data integrity? Data integrity e.g Database integrity means the correctness and consistency of data. It is another form of database protection. Security means that the data must be protected from unauthorized operations.

Integrity is related to the quality of data. Integrity is maintained with the help of integrity constraints. These constraints are the rules that are designed to keep data consistent and correct. They act like a check on the incoming data. It is very important that a database maintains the quality of the data stored in it. DBMS provides several mechanisms to enforce integrity of the data.

Types of integrity

Two types of data integrity are as follows:

  1. Entity integrity

The entity is a constraint on primary key value. It states that any attribute of a primary key cannot contain null value. If primary key contains null value, it is not possible to uniquely identify a record in a relation. Entity integrity ensures that it should be easy to identify each entity in the database.

  1. Referential Integrity

The referential integrity is a constraint on foreign key value. It states that if a foreign key exists in a relation, the foreign key value must match the primary key value of some tuple in its parent relation.

Referential integrity preserves the defined relationship between tables when records are added or deleted. It ensures that key values are consistent across the tables.

A value cannot be inserted in foreign key field if it has no corresponding value in primary key field of the related table. In the following figure, Child table connects to Parent table with RollNo. The values of RollNo in Child table must also exist in parent table.

 table

Figure4.1: Referential Integrity