2013年12月18日 星期三

[Oracle]UNIQUE CONSTRAINT和PRIMARY KEY有何不同

PRIMARY KEY裡的任何一個欄位均不得為空值
UNIQUE CONSTRAINT允許其中的欄位有空值,但是欄位的組合仍必須為唯一

英文說明

WHAT IS THE DIFFERENCE BETWEEN A UNIQUE CONSTRAINT AND A PRIMARY KEY?

Primary KeyUnique Constraint
None of the fields that are part of the primary key can contain a null value.Some of the fields that are part of the unique constraint can contain null values as long as the combination of values is unique.
Oracle does not permit you to create both a primary key and unique constraint with the same columns.

沒有留言:

張貼留言