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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: [Q] what difference between PK and unique index + not NULL??

RE: [Q] what difference between PK and unique index + not NULL??

From: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Tue, 18 Jan 2005 11:27:49 -0800
Message-ID: <B5C5F99D765BB744B54FFDF35F60262119FC86@irvmbxw02>


If I put a PK constraint on columns A and B, I don't need a separate not null constraint on those columns to prevent null values in those columns. With a unique constraint on columns A and B, I would need additional not null constraints to prevent null values in those columns.

Another difference is that a table can have only one primary key constraint but several unique constraints.

Some third-party software tools might require you to have a primary key constraint to do certain operations on a table.

The Oracle optimizer might view a PK constraint differently than a unique constraint on not null columns, one of the performance experts on the list could probably say a word or two about that.

Finally, there are probably some theoretical design considerations that say your model should have a PK for each table.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of dba1 mcc Sent: mardi, 18. janvier 2005 10:59
To: oracle-l_at_freelists.org
Subject: [Q] what difference between PK and unique index + not NULL??

I have some argued with contractor about Primary key and Unique index + Not NULL. Contractor said Primary Key =3D (field specify NOT NLL and create unique index ..). I rember some documents say Primary Key and (unique index, not null) still some different.

Does anyone have opinion?

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jan 18 2005 - 22:19:14 CST

Original text of this message

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