RE: [PHP-DB] foreign key problem

From: Date: Wed, 31 Jan 2001 09:06:09 +0000
Subject: RE: [PHP-DB] foreign key problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6277@lists.php.net to get a copy of this message
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:rjhalljr@starpower.net] > Sent: 31 January 2001 01:53 > To: php-db@lists.php.net > 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: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#6277) next »