McKinsey & Company Interview Question: What's the difference between... | Glassdoor

Interview Question

Data Analyst Interview

What's the difference between primary key and unique key


Interview Answer

3 Answers


Primary key may have duplicate values, unique key must have only 1 entry

Anonymous on May 23, 2017

There can be only one primary key, whereas there can be multiple unique keys.
Unique keys can be null

Anaonymous on Jul 10, 2017

Example : There's a Person table with name and document number. Name is a primary key and document number will be a unique key. Let's say that Mary is not of age for a document yet, so Mary has a null document number. Now Mary is of age and gets a document number 'x'. Sadly Mary lost her document and has to get a new document number, which can't be equal to any previous number.

Anonymous on Feb 28, 2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.