Database definition

What is data integrity in databases?

What does data integrity mean?

Data integrity is the overall completeness, accuracy, and consistency of data. This can be indicated by the absence of corruption between two instances or between two updates of a data record, which means that the data is intact and unchanged.

Data integrity is usually enforced during the database design phase through the use of standard procedures and rules. It is maintained through the use of various error checking methods and validation procedures.

Techopedia Explains Data Integrity

Data integrity could be enforced at both the physical and logical level. The former includes protecting data from various external factors such as power outages, unexpected disasters, data breaches, damage caused by human operators, etc. The latter concerns the maintenance of the rationality of data within relational databases.

Logical integrity is compromised when an error occurs, such as when a human operator makes a mistake when manually entering data into the database. Other common reasons data integrity can be compromised include bugs and/or malware, and transferring data from one database site to another where certain fields are missing.

Data integrity is enforced in hierarchical and relational database models. The following three integrity constraints are used in a relational database structure to ensure data integrity:

Entity Health

This addresses the concept of primary keys and ensures that no data is redundant and no field is null (such as when a numeric cell contains text information). The rule states that each table must have its own primary key and each must be unique and not null.

Referential integrity

This refers to all the procedures and rules applied to ensure that data is stored and used consistently. This is the concept of foreign keys.

The foreign key rule states that the foreign key value can be in two states. The first state is that the foreign key value would refer to a primary key value from another table, or it can be null. Being null can simply mean that there are no relations or that the relation is unknown.

Domain health

Domain integrity is a set of rules and procedures that ensure that all data items belong to the correct domains. For example, if a user enters a date of birth in an address field, the system will display an error message that will prevent the user from filling in that field with incorrect information.

The concept of data integrity ensures that all data in a database can be traced and connected to other data. This ensures that everything is retrievable and searchable. Having a single, well-defined, and well-controlled data integrity system increases stability, performance, reuse, and maintainability.

If any of these features cannot be implemented in the database, they must be implemented through software. A set of best practices such as scheduling regular backups, limiting the permissions required to access sensitive data sets, or tracking changes through logs generally helps protect data integrity.

This definition was written in the context of databases.