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
How to run sql statements with oracle sql developer?
Explain foreign key in sql?
What is an alias command?
How many row comparison operators are used while working with a subquery?
mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql
Are sql connections encrypted?
What are all types of user defined functions?
Is sql injection illegal?
What is trigger price?
What is latest version of sql?
Can we change the table name in sql?
What is pivot in sql?
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
Are subqueries faster than joins?
Differentiate between pl/sql and sql?