php中索引类型,mysql索引类型介绍

建表:

creat table student(

stu_id int unsigned not null auto_increment,

name varchar(32) not null default '',

phone char(11) not null default '',

stu_code varchar(32) not null default '',

stu_desc text,

primary key ('stu_id'), //主键索引

unique index 'stu_code' ('stu_code'), //唯一索引

index 'name_phone' ('name','phone'), //普通索引,复合索引

fulltext index 'stu_desc' ('stu_desc'), //全文索引) engine=myisam charset=utf8;

更新:

alert table student add primary key ('stu_id'), //主键索引

add unique index 'stu_code' ('stu_code'), //唯一索引

add index 'name_phone' ('name','phone'), //普通索引,复合索引

add fulltext index 'stu_desc' ('stu_desc'); //全文索引删除:

alert table sutdent

drop primary key,

drop index 'stu_code',

drop index 'name_phone',

drop index 'stu_desc';

推荐教程:mysql教程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值