一、创建索引
1.PRIMARYKEY(主键索引)
mysql > ALTERTABLE`table_name`ADDPRIMARYKEY (`column`)
2.UNIQUE(唯一索引)
mysql > ALTERTABLE`table_name`ADDUNIQUE (`column` )
3.INDEX(普通索引)
mysql > ALTERTABLE`table_name`ADDINDEX index_name (`column`)
4.FULLTEXT(全文索引)
mysql > ALTERTABLE`table_name`ADDFULLTEXT ( `column` )
5.多列索引(组合索引)
mysql > ALTERTABLE`table_name`ADDINDEX index_name (`column1`,`column2`,`column3`)
CREATE TABLE table_name ( ID INT NOT NULL, username VARCHAR(16) NOT NULL, city VARCHAR(50) NOTNULL, age INT NOT NULL );
二、删除索引
删除索引的语法: DROP INDEX [ indexName ] ON mytable;
后面继续更新!