🛠️ Scheduled Maintenance | We’ll be undergoing scheduled maintenance and upgrades between 00:00 PST Jan 26th until 00:00 PST Jan 28th. There may be brief interruption of services in that period. We apologize for the inconvenience.

The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

primary key

primary key


What is the difference between primary key and unique key ?

1 Answer

365 Team

Hi Karan!
Thanks for reaching out!
Unique key means that the values within that column are unique. You can have 1, 2, 3 or more fields whose values are unique, and that’s why you can have 0, 1, 2, 3 or more unique keys.
Primary keys have another function – to uniquely identify each record in a table. You can have only one such column/field, and it will be your primary key.
Hence, it is logical that a primary key is a type of unique key itself. But there can be only one primary key (regardless of whether it has been composed of only one column, or of many columns), that identifies each record in a table uniquely.
So, you can think of a primary key as a unique key that has the task to uniquely identify each record in a table.
Also, primary and unique keys cannot share fields. Among the various constraints that could apply to a specific field, the primary key and the unique key constraint potentially are two exclusive options.
Hope this helps.


1 year