SQL Database Concepts Question:
Download Questions PDF

What is the difference between a primary key and a unique key?

Basic SQL Server Interview Question
Basic SQL Server Interview Question

Answer:

- Primary key is a combination of columns which uniquely specify a row whereas a unique key is related to the superkey and can uniquely identify each row in the table.
- Primary can only be one in each table as it is one of the special cases of the unique key whereas a unique key can be many.
- Primary key enforces the NOT NULL constraint whereas unique key doesn’t. Due to this values in the unique key columns may or may not be NULL.

Download Basic SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
Explain what is RAID and what are different types of RAID levels?Do you know what is bit data type and whats the information that can be stored inside a bit column?