Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: [Q] what difference between PK and unique index + not NULL??
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-lReceived on Tue Jan 18 2005 - 22:19:14 CST
![]() |
![]() |