Computer Science, asked by aniket8299, 1 year ago

Write one similarity and one difference between UNIQUE and PRIMARY KEY constraints.

Answers

Answered by ckroyofficial
6

The difference between a UNIQUE constraint and a Primary Key is that per table you may only have one Primary Key but you may define more than one UNIQUE constraints. Primary Key constraints are not nullable. UNIQUE constraints may be nullable.

When you create a UNIQUE constraint, the database automatically creates a UNIQUE index. For MS SQL Server databases, a PRIMARY KEY will generate a unique CLUSTERED INDEX. A UNIQUE constraint will generate a unique NON-CLUSTERED INDEX.

Similar questions