DATABASE & SQL/PLSQL

adplus-dvertising
Data Integrity
Previous Home Next

There are three most important things when database is accessing:

  1. Accurate
  2. Consistent
  3. Reliable, means its very tuff to maintain data integrity.

Data integrity ensures the consistency and correctness of data stored in a database. It is broadly classified into the following four categories:

Entity Integrity

Entity integrity ensures that each row can be uniquely identified by an attribute called the primary key. The primary key can not be NULL.

Example:

there might be two candidates for interview with the same name 'alok'. they can be identified using the unique code assigned to them.

Domain Integrity

Domain integrity ensures that only a valid range of values is allowed to be stored in a column. It can be enforced by restricting the type of data, the range of values, and the format of data.

Example:

Let assume that table BranchOffice, that contain various offices of a company and this table has another column city that store the cities where branch offices are located. Assume that offices are located in 'Delhi', 'Mumbai', 'Chanai'. By enforcing the integrity we ensure that only valid values can be entered in the city column of the BranchOffice table.

Referential Integrity

Referential Integrity ensures that the values of the foreign key match with the value of the corresponding primary key.

Example:

In a CollegeStudent table each student has there enrollment number in the column, another table in university database is UniversityStudent which contain Enrollment number that make ensure registration of each student.

User-defined Integrity

User-defined integrity refers to a set by a user, which do not belong to the entity, domain, and referential integrity categories.

Example:

If you want a candidate who is less than 18 years to apply for a post.

Previous Home Next