What is the difference between uniqe index/unique/unique key/unique constraint keywords?

use*_*669 4 mysql mysql-5.5

I am using mysql 5.5.16

What is the difference between the following DDL statements?

1)
create table sql_query (
    id int not null
    , query_text varchar(21826) not null
    , query_md5 binary(16) not null
    , primary key (id)
    , unique index query_md5_index (query_md5)
) engine=InnoDB;

2) 
create table sql_query (
    id int not null
    , query_text varchar(21826) not null
    , query_md5 binary(16) not null
    , primary key (id)
    , unique query_md5_index (query_md5)
) engine=InnoDB;

3)
create table sql_query (
    id int not null
    , query_text varchar(21826) not null
    , query_md5 binary(16) not null
    , primary key (id)
    , constraint md5_constraint unique (query_md5)
) engine=InnoDB;

4)
create table sql_query (
    id int not null
    , query_text varchar(21826) not null
    , query_md5 binary(16) not null
    , primary key (id)
    , unique key query_md5_key (query_md5)
) engine=InnoDB;
Run Code Online (Sandbox Code Playgroud)

Which one should I use? I want to ensure that the there are no rows with the same value for query_md5 and also want to create an index on that column so that searches on that column are fast.

I read the manual at https://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html but it is not very helpful.

小智 5

没有,除非你正在使用一个不同的名称唯一索引,这是所有的第三个所有SQL语句之间的差异。

它们都创建了一个唯一的键/索引,constraint md5_constraint unique (query_md5)具有相同的效果。

只需为唯一键选择您喜欢的名称,并随意使用您的任何查询。:)