Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: URGENT: Primary key vs Unique Index

Re: URGENT: Primary key vs Unique Index

From: Keystroke <keystrk_at_feist.com>
Date: 1997/02/26
Message-ID: <5f08ap$jqf@wormer.fn.net>#1/1

In previous post Mars <mars_at_mediadata.com.sg> wrote:

>Bill Bearden wrote:
>>
>> There are two important differences between Primary and Unique Keys.
>>
>> 1. There can only be one Primary Key on a table. There can be more than
>> one column with Unique Key.
>> 2. Primary Key columns can't contain NULL. Unique Key columns can.
>>
 

>Pardon my ignorance but why can't a primary key be NULL ? Is it a rule
>or is it specific to just Oracle ?

It is a rule that is applicable to any well-behaved relational database.

Only Primary Keys can become foriegn keys in another table. To prevent an ambiguity as to which row the foriegn key is pointing, you really shouldn't (and yoiu can't, in Oracle) create nullable foriegn keys. Therefore, the easiest way to insure that you do not create nullable foriegn keys is to insure that 1) you only can create foriegn keys from primary keys and 2) you cannot create a primary key from nullable columns.


'Keystroke'
Jack L. Swayze Sr.
Sr. Data Analyst
Koch Materials Co.
(a business unit of Koch Industries, Inc.)

Personal: Keystrk_at_Feist.com
Work: SwayzeJ_at_KochInd.com

Anything stated herein is the sole opinion of Jack Swayze, and is not to be considered the position of Koch Industries. Received on Wed Feb 26 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US