Data Integrity |
Maintaining data integrity refers to the problem of ensuring the accuracy of the data in the database
Some valid examples for lack of integrity are :
- an employee havin gworked for 250 hours in the week
- a lsit of employee numbers for a given department with numbers pertaining to non-existing employees.
As an example, consider the following scenario :
One of the vendors has been black-listed and his details are to be removed from the vendor master file
If a check is not made in the purchase order file to ensure that no orders are pending for that vendor before the vendor master
maintenance program actually deletes the vendor details, there are chances of one or more records existing
in the purchase order file with no corresponding vendor information
Deleting the master record without first deleting the corresponding transaction records is formally denoted as failure of referential integrity.
A DBMS overcomes this problem automatically by implementing (defining and enforcing) integrity constraints to be specified along with the data definition.
Any data that goes into the database is validated against a set of rules or constraints, irrespective of the application program that
modifies or inserts the data
The simplest type of integrity constraint involves specifying a datatype for each data item
As an example... Declaring employee number as an integer between 1 and 1000 and
declaring employee-name as a string that is 45 characters wide.
Another type of cosntraint involves specifying uniqueness on data item values.
As an example... the values of employee-number should be unique. If an employee-number with value 500 already exists, the system should not
accept 500 as employee-number when an entry is attempted.