007.02 Blaha Referential Integrity Is Important For Databases November 2005

007.02 Blaha Referential Integrity Is Important For Databases November 2005

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Page 1 Referential Integrity Is Important For Databases Michael Blaha (blaha@computer.org) Modelsoft Consulting Corp www.modelsoftcorp.com Abstract 1. Introduction Referential integrity is a database constraint that ensures that references between data are indeed valid and intact. Referential integrity is a fundamental principle of database theory and arises from the notion that a database should not only store data, but should actively seek to ensure its qual- ity. Here are some additional definitions that we found on the Web. • “Referential integrity in a relational database is consis- tency between coupled tables. Referential integrity is usually enforced by the combination of a primary 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 field. ..” [5] • “[Referential integrity is] a feature provided by relational database management systems (RDBMS’s) that prevents users or applications from entering inconsistent data. Most RDBMS’s have various referential integrity rules that you can apply when you create a relationship be- tween two tables.” [6] • “[Referential integrity is] a database management safe- guard that ensures every foreign key matches a primary key. For example, customer numbers in a customer file are the primary keys, and customer numbers in the order file are the foreign keys. If a customer record is deleted, the order records must also be deleted; otherwise they are left without a primary reference. If the DBMS does not test for this, it must be programmed into the applica- tions.” [7] There are many benefits of defining referential integrity in a database. Improved data quality . An obvious benefit is the boost to the quality of data that is stored in a database. There can still be errors, but at least data references are genuine and intact. Faster development . Referential integrity is declared. This is much more productive (one or two orders of mag- nitude) than writing custom programming code. Fewer bugs . The declarations of referential integrity are more concise than the equivalent programming code. In essence, such declarations reuse the tried and tested gen- eral-purpose code in a database engine, rather than rede- veloping the same logic on a case-by-case basis. Consistency across applications . Referential integrity ensures the quality of data references across the multiple application programs that may access a database. You will note that the definitions from the Web are ex- pressed in terms of relational databases. However, the prin- ciple of referential integrity applies more broadly. Referen- tial integrity applies to both relational and OO databases, as well as programming languages and modeling. 2. Referential Integrity and RDBMSs
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

007.02 Blaha Referential Integrity Is Important For Databases November 2005

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online