1.2 Referential Integrity

 < Day Day Up > 



We know that Referential Integrity is a mechanism used to validate data between primary and foreign key columns in related tables. The primary key is placed on the parent table and the foreign key is placed on a child table. The primary and foreign key values must be the same. Referential Integrity is a set of rules that a relational database uses to ensure that data does not go missing.

What is all this in English? That is very simple to explain. What happens if we have a customer database with associated, or "related", invoices. Now let's assume for an instant that we have no Referential Integrity and a customer is deleted from the database. Well, since we cannot physically get inside the bits and electronics of our database the invoices are essentially, electronically lost! Why? Because it is highly likely that our applications will only ever find invoices by looking at the customers first. Even if this is not the case the invoices will only have a reference to the customer and we won't know whom to mail the invoices to and thus whom to bill. Not billing is likely to persuade the customer not to pay, not on time at least: certainly a sorry state of affairs.

That is what Referential Integrity is and why we should use it.

There is a small but distinct difference between Normalization and Referential Integrity. Normalization is a process of building entities to represent organized data and joining them together with relationships. Referential Integrity is the process of enforcing entity relationships using constraints or rules. Oracle Database rules are called triggers. Triggers are "fired" based on the occurrence of an event.

The next chapter examines how to tune with the relational database model.



 < Day Day Up > 



Oracle High Performance Tuning for 9i and 10g
Oracle High Performance Tuning for 9i and 10g
ISBN: 1555583059
EAN: 2147483647
Year: 2003
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net