Pages

Men

rh

10/29/2013

Data Integrity in SQL Server

Data Integrity:- It refers to the consistency and accuracy of data that is stored in the data base.

Enforcing the Data Integrity ensures the quality of the data base.

Three types of Data Integrity
  •     Domain or Column Integrity
  •      Entity or Table Integrity
  •      Referential integrity


Domain Integrity:- 
Specifies a set of data values that are valid for  a column and determine whether  to allow null values. Domain Integrity is often enforced by using validity checking and can be enforced by restricting the data type, format, or range of possible values  allowed in a column.

Entity Integrity:-
It requires all rows in a table have a unique identifier, known as primary key value. Whether Primary key value can be changed, or whether the whole row can be deleted, depends on the level of integrity required between the primary key any other table.

Referential Integrity:- 
It ensures, that relationship among the primary keys and foreign keys are always maintained. A row in a reference table can not be deleted, nor can the primary key can changed, if the foreign key refers to the row, unless the cascade action is permitted. You can define referential integrity relationships within the same table or between separate tables.

No comments :

Post a Comment