---
title: "Difference between Primary Key and Unique Key"  
description: "Difference between Primary Key and Unique Key"  
author: "Anonymous User"  
published: 2015-12-15  
updated: 2019-05-06  
canonical: https://www.mindstick.com/forum/33739/difference-between-primary-key-and-unique-key  
category: "database"  
tags: ["sql server", "sql", "sql server 2008", "sql server 2012"]  
reading_time: 2 minutes  

---

# Difference between Primary Key and Unique Key

I want to use [Difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between [Primary Key](https://www.mindstick.com/blog/214/primary-key) and [Unique Key](https://answers.mindstick.com/qa/116303/explain-database-primary-key-vs-unique-key) please help me

## Replies

### Reply by Susan White

Thanks for useful answers

### Reply by Sarah Alfred

I am looking for this thanks for sharing it with the community.

### Reply by Alice Taylor

Post is removed by the Admin.

### Reply by asian fanfics

Post is removed by the Admin.

### Reply by Anonymous User

## Primary Key:

- There can only be one primary key in a table
- In some DBMS it cannot be NULL
- Primary Key is a unique key identifier of the record

## Unique Key:

- Can be more than one unique key in one table
- The unique key can have NULL values
- It can be a candidate key
- The unique key can be NULL and may not be unique

### Reply by Anonymous User

SQL Server, we have two keys which distinctively or uniquely identify a record in the database. Both the keys seems identical, but actually both are different in features and behaviours. In this article, I would like to share the key difference between [primary](https://www.mindstick.com/forum/156805/how-to-set-primary-key-constraints-on-multiple-columns-in-a-table-in-sql-server) key and [unique](https://www.mindstick.com/blog/12870/how-to-be-unique-in-business) key. For more help about keys in SQL Server refer the article Different Types of SQL Keys.

**Difference between Primary Key & Unique Key**Primary KeyUnique KeyPrimary Key can't accept null values.Unique key can accept only one null value.By default, Primary key is clustered index and data in the database table is physically organized in the sequence of clustered index.By default, Unique key is a unique non-clustered index.We can have only one Primary key in a table.We can have more than one unique key in a table.Primary key can be made foreign key into another table.

Unique Constraint can not be related with another table's as a Foreign Key.

```
CREATE TABLE Employee  ( Emp_ID int PRIMARY KEY, Emp_Name varchar (50) NOT NULL, Emp_Sal int UNIQUE,  Location int NULL )
```


---

Original Source: https://www.mindstick.com/forum/33739/difference-between-primary-key-and-unique-key

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
