All data values stored in the database are in the correct state. If an incorrect data value is stored in the database, the database is called lost data integrity.
Detailed explanation
The data in the database is input from the outside world, and the input is invalid or error information due to various reasons. It is the primary concern of the database system, especially the multi-user relational database system, to ensure the input data conform to the regulations. Data integrity is therefore presented. This chapter describes the concept of data integrity and how it is implemented in SQL Server.
Data integrity (Integrity) refers to the accuracy (accuracy) and reliability (reliability) of data. It is intended to prevent the existence of non-conforming data in the database and to prevent invalid operations or error messages due to the input and output of the error message. Data integrity is divided into four categories: entity integrity (Integrity), Domain integrity (Integrity), referential integrity (referential Integrity), User custom integrity (user-definedintegrity).
The database uses several methods to ensure data integrity, including foreign keys, constraints, rules, and triggers. The system handles the relationship of the four well, and uses different methods for different situations to cross-use each other and to complement the shortcomings.
(The above from the Sogou encyclopedia)
ENTITY integrity constraint: Constraint on a column (primary key (PRIMARY key) constraint)
Domain integrity constraints: Constraints on a row (default (defaults) constraint , check constraint,non-null constraint)
Referential integrity constraint: FOREIGN key (foreign key) constraint that is related to the primary key
User-defined constraints: In addition to implicit constraints, the designer of a relational database can also set specific additional constraints on the database, which are called "User-defined constraints"
Data integrity for SQL Server databases