4
Reply

What is the difference between PRIMARY KEY and UNIQUE KEY with NOT NULL constraint?

Anantha Narayanan

Anantha Narayanan

17y
10.4k
0
Reply

    primary-single, auto increment,not null,one primary key allowed unique-nullable,allowed unique key more,

    Hi. in data level we have: Primary key = unique identifier of a row in DB & is NOT NULL. Unique key = unique identifier of a row in DB & is NULL ABLE. in perfect design model we have: Primary key = unique identifier of an entity and is meaningless. Unique key = unique identifier of a entity and is meaningful.

    the primary diffrence bitween primary key & unique key is when we  assign primary key to a particular column cluster index automatically created for that column.

    primary key= unique +not null+ clustered index

    17y
    0

    Both of them are same. we can say primary key=unique key+not null