What is Referential Integrity?

Answer Posted / iain hambleton

Expanding on the two previous explanations, imagine any
parent/child relationship, for example a manufacturer and
product relationship that a retailer would have in it's
inventory system. Obviously any product must have been
manufactured by someone (i.e. a product cannot exist
without a manufacturer). Imagine then if in the inventory
system above, some muppet deleted records from the
manufacturer table. This would lead to products existing
in the system without a corresponding manufacturer record -
this is logically inconsistent data (as it does not fit
with the real world situation that the data is trying to
model).

If a foreign key constraint were to have been placed
between the two tables, then the muppet from above would
either have been unable to delete the manufacturer records
without first visiting the products table and deleting all
products that particular manufactures made or when the
manufacturers were deleted, all products linked to them
would have been automatically deleted also (this latter
situation is called a cascade delete – powerful and
dangerous stuff).

Either way, the remaining data would have been left
consistent with the real world manufacturer/product
relationship (though of course large swathes of data may
still have been deleted).

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between clustered and non-clustered index in sql?

514


What is materialized view. What are different methods of refresh?

775


Are stored procedures faster than queries?

518


Is natural join same as inner join?

501


How to load data with sql*loader?

541






What is a database event trigger?

581


name 3 ways to get an accurate count of the number of records in a table? : Sql dba

560


Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?

574


What is clustered index sql?

499


explain the options of myisamchk to improve the performance of a table. : Sql dba

541


How does one use sql*loader to load images, sound clips and documents? : aql loader

668


What is scalar function in sql?

525


define sql delete statement ? : Sql dba

548


what is transaction? : Sql dba

525


What is index example?

547