Categories
Sql Server

What is Data Integrity in Sql server and its types

What is Data Integrity in Sql server and its types

An important part in database designing and planning is deciding way to enforce the integrity of the data. Data integrity refers to the consistency and accuracy of data that is stored in your database.Enforcing data integrity ensures the quality of the data in your database.

Three types of data integrity are:

Column Integrity:- Column integrity specifies a set of data values that are valid for a column and determines whether to allow null values or not. Column integrity is often enforced by restricting the data type, format, or range of possible values allowed in a column.

Entity Integrity:- Entity integrity requires that all rows in a table have a unique identifier, known as the primary key value.

Referential Integrity:- Referential integrity ensures that the relationships between the primary keys and foreign keys are always maintained.

You can use data types,constraints,defaults,triggers to enforce the data integrity in your database.