索引和优化查询 恰当的索引可以加快查询速度,可以分为四种类型:主键.唯一索引.全文索引.普通索引. 主键:唯一且没有null值. create table pk_test(f1 int not null,primary key(f1)); alter table customer modify id int not null, add primary key(id); 普通索引:允许重复的值出现. create table tableanme (fieldname1 columntype,fie…