What is the difference between UNIQUE KEY and UNIQUE INDEX?
Answer Posted / mallik
Unique Index and Unique Constraint are the same. They
achieve same goal. SQL Performance is same for both.
Add Unique Constraint
ALTER TABLE dbo.<tablename> ADD CONSTRAINT
<namingconventionconstraint> UNIQUE NONCLUSTERED
(
<columnname>
) ON [PRIMARY]
Add Unique Index
CREATE UNIQUE NONCLUSTERED INDEX
<namingconventionconstraint> ON dbo.<tablename>
(
<columnname>
) ON [PRIMARY]
There is no difference between Unique Index and Unique
Constraint. Even though syntax are different the effect is
the same. Unique Constraint creates Unique Index to
maintain the constraint to prevent duplicate keys. Unique
Index or Primary Key Index are physical structure that
maintain uniqueness over some combination of columns across
all rows of a table. It is a convenient way to enforce a
Unique Constraint for SQL Server.
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
what is the difference between delete and truncate commands? : Sql dba
How do I install microsoft sql?
Which join condition can be specified using on clause?
what are the different tables present in mysql? : Sql dba
What operators deal with null?
What is primary key secondary key alternate key candidate key?
Is sql better than excel?
describe transaction-safe table types in mysql : sql dba
what is self-join? : Sql dba
What are all types of user defined functions?
what is foreign key? : Sql dba
How many functions are there in sql?
Is id a reserved word in sql?
what is the different between now() and current_date()? : Sql dba
Explain the update statement in sql