How does the UNIQUE constraint differ from the PRIMARY KEY constraint in DB2?

  • Allows NULL values and duplicate values
  • Allows NULL values but enforces uniqueness
  • Allows duplicate values but enforces uniqueness
  • Does not allow NULL values but enforces uniqueness
The UNIQUE constraint in DB2 ensures that all values in a column (or a combination of columns) are unique, but it allows NULL values. On the other hand, the PRIMARY KEY constraint also enforces uniqueness but does not allow NULL values, and it uniquely identifies each row in a table. 
Add your answer
Loading...

Leave a comment

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