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

原文地址:https://www.cnblogs.com/zhoulikai/p/3345800.html