Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just came across a weird issue, whereby depending on how I create an index, an index name is required.

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

It seems to me that the CREATE INDEX call, should not make index name required. I'm wondering if this is a MySQLism, or a SQL standard?

share|improve this question
up vote 13 down vote accepted

I don't think that the SQL standard defines how to create indexes at all.

A quote from this Wikipedia page:


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.

share|improve this answer
MySQL is the only DBMS I know which allows adding an explicit index using ALTER TABLE (there are certain cases where implicit indexes will be created by various DBMS to support constraints, but that's not what I mean). – a_horse_with_no_name Jul 18 '13 at 21:25
@a_horse_with_no_name: Duly noted. I don't understand why MySQL forces us to pass an index_name, when clearly it can handle no name underneath. It's a PITA to be forced to do an alter simply to avoid naming indices. – Mike Purcell Jul 19 '13 at 6:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.