Pages

30 Apr 2012

Primary key vs Unique key


SQL allows two interesting keywords to decorate a table - Primary key and Unique key. Differences or similarities are as follows,


    • primary key does not allow nulls but unique key does
    • primary key does clustered indexing, whereas unique key does non clustered
    • both can be used for constraints
    • multiple unique keys can be defined for a table

No comments:

Post a Comment