码迷,mamicode.com
首页 > 其他好文 > 详细

创建索引

时间:2014-09-02 19:48:45      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:ar   on   c   table   har   as   r   user   word   

创建一个表: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)

创建索引

标签:ar   on   c   table   har   as   r   user   word   

原文地址:http://www.cnblogs.com/cRaZy-TyKeIo/p/3952087.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!