Yes sir, you are correct. Thank you for correcting me. In practice, a 
NULL in a foreign key almost always means an orphan record. In most 
applications the designer will want to use the NOT NULL constraint.

Bob Hall

>A foreign key value can be null, if it suits the data application - or that
>is what I've always been taught.
>
>Here is a text book definition of Referential Integrity which was spoon fed
>to me by the Open University when studying their RDBMS course:
>
>"Referential Integrity - If a relation (table), R2 has a foreign key, F,
>that references the primary key, P, in another relation (table), R1, then
>every R2.F entry must either be a value equal to an R1.P primary key value
>or be null"
>
>Regards,
>Chris
>
>  > -----Original Message-----
>  > From: Bob Hall [mailto:[EMAIL PROTECTED]]
>  > Sent: 31 January 2001 01:53
>  > To: [EMAIL PROTECTED]
>  > Subject: Re: [PHP-DB] foreign key problem
>  >
>  >
>  > >hello all!
>  > >i have a little problem ,hope someone can help me out
>  > >the problem is :
>  > >let i have two tables T1 and T2 ,now T1 has following
>  > >fields
>  > >cntryid
>  > >cntryname
>  > >cntrycode etc.
>  > >now cntryid is the primary key now i want to make the
>  > >cntryid a foreign key in table T2 .so how can i do it
>  > >plz help me .
>  > >msjamal
>  >
>  > A column is a foreign key because it contains only values found in
>  > the referenced key, and no NULLs. Design your database so that the
>  > foreign key column contains only values from cntryid.
>  >
>  > If you want to know how to declare a referenced key/foreign key
>  > relationship, you will have to specify what RDBMS you are using.
>  >
>  > Bob Hall
>  >
>  > Know thyself? Absurd direction!
>  > Bubbles bear no introspection.     -Khushhal Khan Khatak
>  >
>  > --
>  > PHP Database Mailing List (http://www.php.net/)
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to