Data Integrity refers to the accuracy, consistency, and correctness of the data. Rules are set up in the database to help ensure the validity of the data. Data integrity falls into the following categories:
Domain integrity is also known as column integrity. Domain integrity specifies a set of data values that are valid for a column. This can be defined by the data type, format, data length, nullability, default value, and range of allowable values.
Entity integrity is also known as table integrity or row integrity. Entity integrity requires that all of the rows in a table have a unique identifier, enforced by either a PRIMARY KEY or UNIQUE constraint.
Referential integrity ensures that the relationships between tables are maintained. Every FOREIGN KEY value in the referencing table must either be NULL, match a PRIMARY KEY value, or match a UNIQUE key value in an associated referenced table. The referenced row cannot be deleted if a FOREIGN KEY refers to the row, nor can key values be changed if a FOREIGN KEY refers to it. Also, you cannot insert or change records in a referencing table if there is not an associated record in the primary referenced table.
User-defined integrity lets you define business rules that do not fall under one of the other integrity categories, including column-level and table-level constraints.