加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

CREATE INDEX vs ALTER TABLE ADD INDEX – MySQLism还是SQL Sta

发布时间:2020-12-12 16:57:30 所属栏目:MsSql教程 来源:网络整理
导读:刚遇到一个奇怪的问题,根据我创建索引的方式,需要索引名称. http://dev.mysql.com/doc/refman/5.5/en/create-index.html http://dev.mysql.com/doc/refman/5.5/en/alter-table.html CREATE INDEX `random_name` ON `my_table` (`my_column`); # Requires an i
刚遇到一个奇怪的问题,根据我创建索引的方式,需要索引名称.

http://dev.mysql.com/doc/refman/5.5/en/create-index.html

http://dev.mysql.com/doc/refman/5.5/en/alter-table.html

CREATE INDEX `random_name` ON `my_table` (`my_column`); # Requires an index name

ALTER TABLE `my_table` ADD INDEX (`my_column`); # Does not require an index name

在我看来,CREATE INDEX调用,不应该使索引名称成为必需.我想知道这是MySQLism还是SQL标准?

解决方法

我认为SQL标准根本??不定义如何创建索引.

来自this Wikipedia page的报价:

Standardization

There is no standard about creating indexes because the ISO SQL
Standard does not cover physical aspects. Indexes are one of the
physical parts of database conception among others like storage
(tablespace or filegroups). RDBMS vendors all give a CREATE INDEX
syntax with some specific options which depends on functionalities
they provide to customers.

The Postgres manual seems to support this here:

There are no provisions for indexes in the SQL standard.

More evidence under this related question on SO.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读