MySQL creates index of Create Index methods and syntax structures and examples

  • 2020-05-09 19:24:40
  • OfStack

CREATE INDEX Syntax

CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
[index_type]
ON tbl_name (index_col_name,...)
[index_type]

index_col_name:
col_name [(length)] [ASC | DESC]

index_type:
USING {BTREE | HASH | RTREE}
 
--  Create a table without an index  
create table testNoPK ( 
id int not null, 
name varchar(10) 
); 
--  Create a normal index  
create index IDX_testNoPK_Name on testNoPK (name); 

Related articles: