CREATE INDEX vs ALTER TABLE ADD INDEX – MySQLism还是SQL Standard?

刚遇到一个奇怪的问题,根据我创建索引的方式,需要索引名称.

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.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...