Environment: MySQL Sever 5.1 + MySQL command line tool
Problem: Creating an Index
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}
Example:
--Create TABLE creation table Testindex with no indexes
(
ID int not NULL PRIMARY key
, name varchar
);
--Create INDEX
idx_test_testindex _name on Testindex (Name);
Description: The name of the index is best used in this way: Idx_databasename_tablename_columnname (IDX for index, databaseName for database name, tablename for table name, ColumnName represents the name of the field, if the concept of the database does not exist under Oracle, instead of the table space, the databasename is replaced with the user name.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/MySQL/