English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-06-22 01:05:31 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

Referential integrity in a relational database is consistency between coupled tables. Referential integrity is usually enforced by the combination of a primary key or candidate key (alternate key) and a foreign key. For referential integrity to hold, any field in a table that is declared a foreign key can contain only values from a parent table's primary key or a candidate key. For instance, deleting a record that contains a value referred to by a foreign key in another table would break referential integrity. The relational database management system (RDBMS) enforces referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. Which method is used would be defined by the definition of the referential integrity constraint.


Example
An employee database stores the department in which each employee works. The field "DepartmentNumber" in the Employee table is declared a foreign key, and it refers to the field "Index" in the Department table which is declared a primary key. Referential integrity would be broken by deleting a department from the Department table if employees listed in the Employee table are listed as working for that department.

2007-06-22 05:30:09 · answer #1 · answered by sathiyendran a 3 · 0 0

Um, I think what the prior answer was trying to say, is that it's a constraint that is placed on an entity as in how it relates to another.

For example, if I have 2 tables and one of them is an order header table, I will have a constraint on my line item table saying that an order must exist in the order header table before I can add any line items to the line item table. If this referential entity constraint exists, you'll get an error if you try to add a row of data to the line item table without a corresponding order in the order header.

The Data Analyst - http://www.squidoo.com/thedataanalyst

2007-06-22 01:48:35 · answer #2 · answered by a_non_a_miss_2000 3 · 0 0

That sounds relational database theory. If a tuple in one entity refers to another tuple or the possibility of some referal relation this says the intended reference must stay firm or modified to keep pace, not left dangled if one change to one of the tuples involved also made changes to the relation itself.

2007-06-22 01:20:13 · answer #3 · answered by Andy T 7 · 0 0

Wow, I wish I could help. Good luck on this one.

2016-05-17 09:04:28 · answer #4 · answered by ? 3 · 0 0

fedest.com, questions and answers