CREATE [UNIQUE|FULLTEXT] INDEX index_nameON table_name (column_list)

Description: Creates an index called index_name on the column or columns given by column_list (names of columns are comma-separated if more than one) of the table table_name.

UNIQUE option specifies a unique index. FULLTEXT option specifies a full-text index that will help a SELECT...WHERE MATCH...AGAINST query. If neither UNIQUE or FULLTEXT are specified, the index will be non-unique.

Synonymous with ALTER TABLE...ADD INDEX.

Limitations: FULLTEXT option works only on VARCHAR and TEXT columns of MyISAM tables, and only in versions 3.23.23 and later.

Description in: Day 9

See also: ALTER TABLE, DROP INDEX

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.