Difference between Primary key and Unique Key

Primary key
Unique Key
1-      Primary key doesn’t have null value.

2-      A table can have only one primary key.

3-      By default primary key have clustered index.
Unique key can hold null value but only once.

A table can have more than on unique key.

By default Unique key have non- clustered index.


No comments:

Post a Comment

PostgreSQL-Query: Sort result set by specific field values using ORDER BY Clause

Problem: Suppose we have a book_inventory table which has some columns such as id, isbn, title, author, publisher, publish_date, etc.. whe...