answersLogoWhite

0

Referential Integrity

Referential integrity means that the foreign key in any referencing table must always refer to a valid row in the referenced table. Referential integrity ensures that the relationship between two tables remains synchronized during updates and deletes.

For example, assume that your application has both a Titles table and a Publishers table as shown in the following table.

Titles table Publishers table ti_isbn (key) pu_id (key) ti_title pu_name ti_yearpublished pu_address pu_id (foreign key) pu_phone

Referential integrity requires that these two tables must be synchronized. That is, each publisher identification (pu_id) in the Titles table must also exist in the Publishers table.

Your application cannot just delete the pu_id row from the Publishers table because that would leave the pu_id in the Titles table without a reference. It would be permissible, however, to delete the pu_id row from the Publishers table and also delete every row in the Titles table that has the same pu_id. Such an action would maintain referential integrity for these two tables.

In a similar manner, your application cannot just add a row to the Titles table without a valid pu_id already in the Publishers table. To do so would insert "bad" data in the pu_id field. So, your application must ensure a valid pu_id key in the Publishers table before inserting the pu_id in the related Titles row.

The actual implementation of referential integrity depends entirely on the data storage engine you choose and your application's design requirements. Historically, applications using mainframe VSAM files used application code to handle referential integrity. Today, even if your application uses SQL Server, that does not mean you must use triggers, foreign keys, constraints, and cascading deletes to maintain referential integrity. You might again choose to handle referential issues with application-based code.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Write a program to implement domain and referential integrity?

give me the program which can related on domain and referential integrity.


What does referential integrity mean?

it means when something got a error or it breaks down


What happens if referential integrity is not enforced?

Without referential integrity enforcement, data inconsistencies may arise, such as orphaned records or invalid references between tables. This can lead to data corruption, incorrect query results, and difficulty maintaining and updating the database. Overall, without referential integrity, the data integrity and reliability of the database can be compromised.


What does a database displays both entity integrity and referential integrity mean?

Entity integrity ensures that each record in a database table has a unique identifier, usually a primary key, while referential integrity ensures that relationships between tables are maintained through foreign key constraints, preventing orphaned records and ensuring data consistency. Displaying both entity and referential integrity means that the database is structured to enforce these rules, helping to maintain data accuracy and reliability.


When is the table exhibit referential integrity?

A table exhibit referential integrity when all foreign key values in a table point to existing primary key values in the referenced table. This ensures that the relationship between the tables is maintained and that data integrity is preserved.


Explain the differences between entity integrity and referential integrity?

In databases, referential integrity refers to ensuring that every value of a relation's attribute exists as a value of another attribute in another relation. Entity integrity is a basic rule that ensures that every relation has a primary key and that this key is unique and not NULL.


In what field is referential integrity applied?

Referential integrity is commonly applied in database management. It ensures that relationships between tables are maintained by enforcing constraints to prevent actions that would result in orphaned records or data inconsistencies.


What Does it mean to say that a database displays both entities integrity and referential integrity?

Entity integrity ensures each record in a database table is uniquely identifiable, typically by using a primary key. Referential integrity guarantees that relationships between tables are maintained, meaning foreign key values in one table must match primary key values in another table. Together, these two types of integrity ensure the consistency and accuracy of data within a database.


How can referential integrity be enforced in an object-oriented system in uml?

Referential integrity in an object-oriented system can be enforced using UML by defining associations between classes with multiplicity constraints. By specifying these constraints (such as 1 to 1, 1 to many, etc.), you ensure that instances of one class are properly connected to instances of another class. This helps to maintain data consistency and integrity within the system.


Why is it desirable to enforce the referential integrity rules and entity integrity rules?

Database Management Systems ensure consistent data if the database is modeled using proper referential integrity. For example, if a Customer record is deleted from the system, all Orders and Order Items pertaining to that Customer should ideally be cleaned up. Same thing is true for a specific Order. Such logic need not be in the application, instead you can set up database referential integrity rules to perform these cascading actions automatically for you.


What is referencial integrity in access?

Referential Integrity is a set of rules that a DBMS (Database management system) follows to ensure that there are matching values in the common field used to create the relationship between related tables and that protects the data in related tables to make sure that data is not accidentally deleted or changed.


A set of rules that Access uses to ensure that the data between related tables is valid?

Referential integrity.