View Single Post
  #2 (permalink)  
Old September 26th, 2003, 10:58 AM
Jeff Mason Jeff Mason is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

A column in a base table which is a foreign key in another table can indeed be null. If there is a referential constraint on the column, then values in that column must be found in the referenced table. But if there is no value in the base column (i.e. NULL), then that is perfectly OK - it doesn't violate the constraint, because NULL means there is no value, so there is nothing to check.

BTW, it is not requirement that the foreign key constraint refer to the primary key of the foreign table, but it usually does. As long as the constraint refers to a column (or columns) which has a UNIQUE constraint defined, the reference will be allowed.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
Reply With Quote