Definition Of Referential Integrity In Computer Science
Referential integrity can also alert you if you try to delete a record which is related to another one.
Definition of referential integrity in computer science. Referential integrity is a standard that means any customer id value in the customer master table may not be edited without editing the corresponding value in the accounts master table. Entity integrity referential integrity and domain integrity. Referential integrity uses these to ensure that there are no orphan records i e. Referential integrity is a database feature in relational database management systems.
So referential integrity requires that whenever a foreign key value is used it must reference a valid existing primary key in the parent table. Every foreign key value has a matching value in the corresponding primary key. A feature provided by relational database management systems rdbms s that prevents users or applications from entering inconsistent data. Primary key constraint has already been defined earlier.
If andrew smith s customer id is changed in the customer master table this change also must be applied to the accounts master table thus allowing andrew smith s account information to link to his customer id. An expression is called referentially transparent if it can be replaced with its corresponding value without changing the program s behavior. Referential transparency and referential opacity are properties of parts of computer programs. Example for example if we delete record number 15 in a primary table we need to be sure that there s no foreign key in any related table with the value of 15.
Data integrity is normally enforced in a database system by a series of integrity constraints or rules. Referential integrity the discussion on the primary key and foreign key constraints is needed to define referential integrity. Three types of integrity constraints are an inherent part of the relational data model. In the context of relational databases it requires that if a value of one attribute column of a relation table references a value of another attribute either in the same or a different relation then the referenced value must exist 1 for referential.
Referential integrity is a property of data stating that all its references are valid. Most rdbms s have various referential integrity rules that you can apply when you create a relationship between two tables.