What is the difference b/w Primary Key and Unique Key

前端 未结 11 1914
孤城傲影
孤城傲影 2020-12-24 13:07

I tried to find it out in google but not satisfactory answer is given out there. Can anybody explain the solid difference.

actually if Primary key is used to sele

11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 13:36

    Primary Key constraint
    1. A primary key cannot allow null.
    2. Multiple primary keys are NOT allowed.
    3. On some RDBMS a primary key generates a clustered index by default.

    Unique constraint
    1. A unique constraint can be defined on columns that allow nulls.
    2. Multiple unique keys are allowed.
    3. On some RDBMS a unique key generates a nonclustered index by default.

    Source Wikipedia

提交回复
热议问题