Correction - A Foreign Key can be NULL.
A trap for the unwary is that unless you select the NOT NULL constraint when creating a Foreign Key, your Foreign Key will permit NULL values. This IS NOT an RBase bug because it conforms to the SQL standard. You can change the NOT NULL constraint for the Foreign Key after the fact. Tony Anthony J. Schmidt, JD President The Computery Ltd. One East Main Street Bay Shore, NY 11706 631-665-8100 Voice 631-969-5988 FAX http://www.computeryltd.com [EMAIL PROTECTED] 04/09/2002 12:13 PM Please respond to rbase-l To: [EMAIL PROTECTED] cc: (bcc: Anthony Schmidt/BayShore/SGU_LN) Subject: Re: Please explain foreign keys, index - Razzak's Reply At 04:00 PM 4/7/2002 -0400, Bernie Lis wrote: >what is diff between foreign key and foreign index? >If I create a foreign index is that column indexed for >look ups in that table. If I create a foreign key do I >still have to build an index for look up in that table? Bernie, TTBOMK there is no such thing as Foreign Index. . An Index is automatically built when a foreign key constraint is defined. . Key is a column or set of columns that identify a row. . All other columns should be dependent on a key. . A key is NOT an index. . A key is often indexed, but these terms are not interchangeable. . Primary Key is a column or set of columns that uniquely identify a row. . Foreign Key is a column or set of columns that link to a Primary Key. . A Foreign Key matches a defined Primary Key, i.e, the value in a Foreign Key reference values in the Primary Key. . A Foreign Key can have duplicate values but cannot have NULLs. . The value in a Foreign Key must exist in a Primary Key and Primary Key also prohibits NULLs. . A Foreign Key replaces a verify a value rule. . Primary and Foreign Keys must match in terms of the specified number of columns. If you have a multi-column Primary Key, you cannot have single column Foreign Keys reference it. If you have a multi-column Foreign Key, it cannot reference a single Primary Key. When a Primary Key is defined as more than one column, those columns are treated as a whole. Primary and Foreign keys must much exactly. Examples (CONCOMP Database): . EmpID is the Primary Key for the Employee table. . EmpID is a Foreign Key in TransMaster table. It relates to the Primary Key in the Employee table. Hope that helps! Very Best Regards, Razzak. ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
