Number of questions 1,751
Number of tests completed 252,582
Number of questions answered 3,766,864
Number of registered users 19,177
Sign In | Register
Skip Navigation Links
Question: what is difference between primary key and unique key?
Answer1: Primary key does not allow a null value but unique key does allow for one null value
Answer2: Primary key cannot be referenced to another table as FK.
Answer3: we can have multiple primary keys in a table but unique is one and only one
Answer4: Primary key will create a clustered index by default
Answer5: 1 and 4
Answer: 1 and 4

Explaination: Differences between Primary Key and Unique Key: Primary Key 1. A primary key cannot allow null values. (You cannot define a primary key on columns that allow nulls.) 2. Each table can have at most one primary key. 3. On some RDBMS A primary key automatically generates a clustered table index by default. Unique Key 1. A unique key can allow null values. (You can define a unique key on columns that allow nulls.) 2. Each table can have multiple unique keys. 3. On some RDBMS A unique key automatically generates a non-clustered table index by default.

Correctly answered: 3701
Incorrectly answered: 1874
Terms of Use Ver. 2.0.6783.38332