Primary key:
The key which is useful for identify a record uniquely in a table.The primary key is a combination of both not null and unique key constraints.the primary key is also useful in references.Primary key creates two data base objects that is one for key and one for automatic index.
Not Null:
Which does not allows a null values into a table.Not Null creates only one object in data base.
Unique key:
The key which does not allows a duplicate values into column is Unique key.the name it self denotes , one that does not matches with other.As like primary key the unique key is also contains two data base objects one for key and other for automatic index.
PRIMARY KEY
|
UNIQUE + NOT NULL
|
1.
One table can
have only one primary key.
2.
Two data base
objects are created
3.
We can’t drop
either unique or not null behavior separately.
4.
It do the best
performance in case of composite primary key
|
1.
One table can have more than one unique + not null key.
2.
Three data base objects are created. That is one for
NOT NULL and two for UNIQUE KEY.
3.
We can drop separately.
4.
Low performance.(more not null constraints are required
with unique key)
|
No comments:
Post a Comment