0% found this document useful (0 votes)
53 views

Data Redundancy and Referential Integrity

Data redundancy refers to unnecessary duplication of data in databases and can cause issues like waste of storage, update anomalies, deletion anomalies, and insertion anomalies. Relational databases are better than flat-file databases at preventing data redundancy. Referential integrity requires that values in one table match values in a related table, ensuring data integrity by preventing inconsistent references. It guarantees data reliability by enforcing consistency between primary and foreign keys if values are updated or deleted.

Uploaded by

paa adubofour
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Data Redundancy and Referential Integrity

Data redundancy refers to unnecessary duplication of data in databases and can cause issues like waste of storage, update anomalies, deletion anomalies, and insertion anomalies. Relational databases are better than flat-file databases at preventing data redundancy. Referential integrity requires that values in one table match values in a related table, ensuring data integrity by preventing inconsistent references. It guarantees data reliability by enforcing consistency between primary and foreign keys if values are updated or deleted.

Uploaded by

paa adubofour
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

DATA REDUNDANCY AND

REFERENTIAL INTEGRITY
Data redundancy
• Data redundancy refers to the condition in a database which permits
unnecessary duplication of data.
• This is normally very common in flat-file databases but not in relational
database (though poorly designed databases can suffer this)
• This affects the integrity and reliability of databases

Flat-file database Relational database


FLAT FILE
Issues caused by data redundancy
1. Waste of Storage: storing data multiple times wastes storage space and
makes the database unnecessarily large.
2. Update anomaly: Any update done to one occurrence of repeated data
must be repeated to all instances of that data. Not doing this leads to
inconsistent data that ultimately impairs the integrity and of the
3. Delete anomaly: Deleting some information can lead to the loss of some
other vital information.
4. Insertion anomaly: This is the inability to a record to a table due to the
absence of some other data (which otherwise is not immediately needed
but required by the database system)
Other issues related to data integrity
• Multiple entry of the same data can also be time consuming and difficult.
• Errors more likely to occur when complex entries are made in several
different files and/or recur frequently in one or more files
Referential integrity
• Referential integrity states that any foreign key field must
agree with the primary key that is referenced by the foreign
key.
• Thus, any primary key field changes must be applied to all
foreign keys, or not at all.
• This also means that any update to a foreign key must be
propagated to the primary parent key.
• Because of this the integrity of data is guaranteed as all
references to a particular field or record would be the same
• Also the data becomes reliable as the chances of having
inconsistent data would be impossible.
• If a foreign key exists in a table, either the foreign key value
must match a candidate key value of some record in its home
table or the foreign key value must be wholly null.
Illustration of referential integrity
Illustration of referential integrity
• For example, suppose Table OrderDetails has a foreign key Order ID that
points to the field OrderID in Table Orders.
• Referential integrity would prevent you from adding a record to table
OrderDetails that cannot be linked to table Orders.
• In addition, the referential integrity rules might also specify that whenever
you delete a record from table Orders, any records in table OrderDetails
that are linked to the deleted record will also be deleted. This is called
cascading delete.
• Finally, the referential integrity rules could specify that whenever you modify
the value of a linked field in Orders, all records in OrderDetails that are
linked to it will also be modified accordingly. This is called cascading update.

You might also like