create table if not exists tbl_item_1(
`id` int(10) not null auto_increment,
`name` varchar(20) not null,
`categoryid` int(10) not null,
`price` double(6,2) not null,
`desc` varchar(20) ,
primary key (`id`),
key `categoryid` (`categoryid`)
)engine=innodb default charset=utf8 auto_increment=1;
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('三星 Galaxy S7 edge(G9350)4GB+32GB 雪晶白',1,3399,'Super AMOLED三星双曲面2K 屏,支持无线充电!');
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('联想(Lenovo)拯救者R720',2,6399.00,'专业游戏键盘新模具全新设计!');
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('Apple iPhone 7 Plus (A1661) 128G 黑色',1,6099,'全国不限流量任意刷,下单更享200M光纤0元购!');
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('索尼(SONY) DSC-RX100M5(RX100V)黑卡数码相机',3,6199,'全新黑卡第五代,火热开抢');
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('海信(Hisense)LED55EC780UC 55英寸 曲面4K智能平板电视',4,4598,'55英寸曲面4K机皇!');
insert into tbl_item_1(`name` ,`categoryid`,`price`,`desc` ) values('苏泊尔无油烟炒锅PC32H2',1,599,'先领券再下单,超值!');
create table if not exists tbl_item_2(
`id` int(10) not null auto_increment,
`name` varchar(20) not null,
`categoryid` int(10) not null,
`price` double(6,2) not null,
`desc` varchar(20) ,
primary key (`id`),
key `categoryid` (`categoryid`)
)engine=myiasm default charset=utf8 auto_increment=1;
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('三星 Galaxy S7 edge(G9350)4GB+32GB 雪晶白',1,3399,'Super AMOLED三星双曲面2K 屏,支持无线充电!');
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('联想(Lenovo)拯救者R720',2,6399.00,'专业游戏键盘新模具全新设计!');
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('Apple iPhone 7 Plus (A1661) 128G 黑色',1,6099,'全国不限流量任意刷,下单更享200M光纤0元购!');
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('索尼(SONY) DSC-RX100M5(RX100V)黑卡数码相机',3,6199,'全新黑卡第五代,火热开抢');
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('海信(Hisense)LED55EC780UC 55英寸 曲面4K智能平板电视',4,4598,'55英寸曲面4K机皇!');
insert into tbl_item_2(`name` ,`categoryid`,`price`,`desc` ) values('苏泊尔无油烟炒锅PC32H2',1,599,'先领券再下单,超值!');
经过mysql5.5.48版本测试,无论使用myisam还是innodb都无法使用到索引。
下面这篇文章中提到mysql 5.7版本使用myisam时可以用到索引,推测可能是后续版本做了改进: