I have seen couple of sample tables one is with UNIQUE INDEX and other is with UNIQUE KEY. what is the difference between two?? or both are same?
-
1see : lists.mysql.com/mysql/218317– Haim EvgiCommented Jul 14, 2010 at 10:52
-
1In MySQL the terms key and index tend to be used interchangeably, as pointed out in the post given by haim evgi. In MS SQL, they can refer to different things: stackoverflow.com/questions/366186/…– MikeCommented Jul 14, 2010 at 11:03
Add a comment
|
1 Answer
CREATE TABLE
KEY is normally a synonym for INDEX.
You can use them interchangeably as described in syntax page
[CONSTRAINT [symbol]] UNIQUE [INDEX|KEY]
-
10No, the syntax page does not say that INDEX and KEY are interchangeable, but can be used as the next argument for the UNIQUE constraint.– abbasCommented Jul 4, 2013 at 10:05
-
1Please be clearer about why KEY and INDEX can be used interchangeably. I found lists.mysql.com/mysql/218317 (from Haim Evgi's comment above) helpful. Commented Jun 23, 2014 at 18:25