Database integrity is the practice of ensuring that data stored in a database are accurate, consistent and free of errors. The slightest spelling error or repetition of information can cause massive problems for a database, so database integrity is taken seriously. The three proponents of integrity are entity integrity, domain integrity and referential integrity. Along with these three, normalization and error checking are applied to further ensure integrity. Most of these processes are automated, but administrators often also check manually to ensure no errors occur in the database.
When an administrator wants to add, change or delete information from the database, the database integrity must first be checked. The inclusion, or changing, of any information can be disastrous, because the data may have far-reaching effects on other tables and sections of the database. To alleviate the chance of this, and to keep the information already in the database accurate, integrity is always checked before any changes can be made.
Entity integrity is the first constraint for database integrity. This checks the table with which the administrator wants to work and looks at the row names. If rows in the same table have the same name, this creates redundant information, which is confusing to the database.
Next comes domain integrity. This checks the type of data consistently added to the table or section and ensures the new data conforms to that data type. For example, if the table is specified to hold only dates and someone tries to enter a word, then the domain integrity process will alert the administrator to a consistency error. This is because the table is only meant to handle dates, so having a word will mess up the regular processing and can cause errors in the future.
The third constraint in database integrity is referential integrity. The tables in a database are rarely alone — other tables often reference them and they reference other tables. If the administrator commands one table to reference another, but the second table is misspelled or does not exist, this causes processing errors. Referential integrity checks to ensure all references are valid.
Aside from these three integrity issues, the rules of normalization and error checking also are applied for true database integrity. Normalization seeks out redundant information and unnecessarily long tables, eliminating the redundancy and turning long tables into several short tables, respectively. Error checking analyzes the database for any other potential errors and ensures all data are valid.