MySQL中“ADD KEY”和“ADD INDEX”有什么区别? [重复]

时间:2022-09-16 14:17:45

This question already has an answer here:

这个问题在这里已有答案:

I dump database and i have one question. What does this query?

我转储数据库,我有一个问题。这个查询是什么?

ALTER TABLE `ps_cart_rule` ADD KEY `id_customer` (`id_customer`,`active`,`date_to`);
ALTER TABLE `ps_cart_rule` ADD KEY `id_customer_2` (`id_customer`,`active`,`highlight`,`date_to`);

What is diffrence between ADD KEY and ADD INDEX?

ADD KEY和ADD INDEX之间的差异是什么?

1 个解决方案

#1


19  

KEY is a synonym for INDEX.

KEY是INDEX的同义词。

... | ADD {INDEX|KEY} [index_name] ...

...... |添加{INDEX | KEY} [index_name] ...

Check the MySQL documentation for ALTER TABLE.

检查ALTER TABLE的MySQL文档。

#1


19  

KEY is a synonym for INDEX.

KEY是INDEX的同义词。

... | ADD {INDEX|KEY} [index_name] ...

...... |添加{INDEX | KEY} [index_name] ...

Check the MySQL documentation for ALTER TABLE.

检查ALTER TABLE的MySQL文档。