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

  • Both primary key and unique key are the same
  • Primary key allows duplicate values, Unique key does not
  • Primary key can have null values, Unique key cannot
  • Unique key can have null values, Primary key cannot
The key difference is that a primary key cannot have null values, ensuring each record is uniquely identified, while a unique key can have null values, allowing for some flexibility in data constraints.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *