[Opensource] Réf. : [Opensource] referencial integrity

Raul DAVIDOVICH R.DAVIDOVICH at caconcology.com
Sun Sep 28 15:09:25 PDT 2003


Hello,


Referential integrity is tipically used in master - detail relationships.. 
what it means in practice is that when you have a referential integrity 
constraint between two tables of a database, the information entered in 
the detail table must reference an existing line in the master table, and 
a line of the master table cannot be erased if there are lines in the 
detail table referencing it, or if you delete the master line, the detail 
lines will be deleted in cascade.


Example:

table customer:

ID      NAME    ADDRESS WHATEVER
1       TOTO    18 STREET       COUCOU
2       TITI    21 AVENUE       IM BIG GUY


table item

ID      DESCRIPTION             STOCK
24      BOLTS                   2500
36      NUTS                    2500

table order

ID      ITEM    QUANTITY        CUSTOMER
1       24      1               1               ... this will work
2       36      3               1               ... this will work
3       02      2               4               ... this will not work.. 
Neither Customer 4 or item 02 exist


The same, if I try to delete customer 1, the system will complaint.


Hope this helps



Regards,



---------------------------------------------------
Raul Davidovich
Responsable Informatique
Cvitkovic & Associés Consultants

(33) 1 45 15 40 68
(33) 1 45 15 40 41 Fax
-------------------------------------------------------
http://www.caconcology.com




"Stephen Marron" <stephenmarron at hotmail.com>
Envoyé par : opensource-admin at jcorporate.com
27/09/2003 15:27
Veuillez répondre à opensource

 
        Pour :  <opensource at jcorporate.com>
        cc : 
        Objet : [Opensource] referencial integrity


Hello,
My name is Stephen Marron.
I am currently studying at the Institute of Technology, Sligo, Ireland. I 
am doing a degree in Web Development and as part of my course i am doing a 
subject called Database Technology!
I am having trouble with this subject as i cannot understand the term referencial integrity.
 
If at all possible could you define it for me in one or two lines in 
simple terms which might make more sense to me.
 
Many Thanks.
Regards
Stephen Marron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030929/c45f4fac/attachment-0002.htm


More information about the Opensource mailing list