mysql创建单个和联合索引
时间:2014-02-26 04:44:29
收藏:0
阅读:520
首先创建一个表:create table t1 (id int primary key,username varchar(20),password varchar(20));
创建单个索引的语法:create index 索引名 on 表名(字段名)
索引名一般是:表名_字段名
给id创建索引:create index t1_id on t1(id);
创建联合索引的语法:create index 索引名 on 表名(字段名1,字段名2)
给username和password创建联合索引:create index t1_username_password on t1(username,password)
原文:http://blog.csdn.net/zl544434558/article/details/19926623
评论(0)