mysql学习(六)-索引

主键索引:

           确定唯一的一条记录,只能有一个主键(primary key)

    主键不能为空

           1、create table if not exists t1(id int not null auto_increment primary key, name varchar(10) not null default '');

    2、create table if not exists t1(id int not null auto_increment, name varchar(10) not null default '', primary key(id));

 

唯一索引:(unique)

           一张表中可以有多个唯一索引

普通索引(index )加快查询的速度,但是影响插入、删除、修改的速度

    create index inde1 on user(id, name);

 

http://php.lampbrother.net/html/46-1/1452.htm

 

posted @ 2013-09-29 15:26  激扬飞雪  阅读(153)  评论(0编辑  收藏  举报