Difference between PRIMARY KEY and UNIQUE KEY ~ OracleSource

Monday, July 14, 2008

Difference between PRIMARY KEY and UNIQUE KEY

Primary Key

1) There can be only one Primary key in a table.
2) Primary key creates Cluster Index
3) Primary key provide two constraint inforceness "UNIQUE + NOT NULL"
4) We can reference Primary Key for Foreign Key constraint.

Unique Key

1) More than one Unique key can be created in a table
2) Unique Key creates Non-Clustered Index
3) Unique Key provides only "Uniqueness for Table"
4) We can reference Unique Key for Foreign Key constraint.

No comments: