What is the difference between a PRIMARY KEY and a UNIQUE KEY?
- Primary key can store null value, whereas a unique key cannot store null value.
- We can have only one primary key in a table while we can have multiple unique keys
- Primary key cannot be a date variable whereas unique key can be
- None of these
1 Answers
Answer:
2. We can have only one primary key in a table while we can have multiple unique keys
Explanation:
The primary key is a single or combination of the field that identifies each record in a table uniquely. It cannot take a NULL value. A table can have only one primary key. Also, we can create a date variable as a primary key in a table.
Unique key also determines each row of the table uniquely, but it can take null value into. A table can have more than one unique key. We cannot create a date variable as a unique key in a table.