mysql 创建索引 key,Mysql中创建索引的INDEX和KEY

一、问题

被问到,mysql为什么用key创建索引,而不是index。这个被难住了。

二、查一下

关于key和index只有三个页面,primary key,foreign key和create index。

看来使用index是比较标准的语法。

KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems.

这篇对话文章,也挺有意思:

In MySQL, KEY is equivalent to INDEX. It won't check for duplicates without UNIQUE in front of it.

Egor

Wednesday, June 16, 2004

Boy, they should really change the name or behavior then, because that's a *big* departure from the relational definition of "KEY".

Captain McFly

Wednesday, June 16, 2004

另外,我们使用index和key分别创建索引,导出的create syntax是一样的。

三、结论

结论:index和key没有区别(即使有区别,也可以忽略)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值