最新原文:https://www.cnblogs.com/uncleyong/p/14805395.html
说明及要求
说明:
sql优化不只是考虑索引等,有时候还需要对业务逻辑进行优化。本题暂不考虑业务逻辑。
要求:
1、描述现在sql存在的问题
2、描述优化方案,每一个优化改动是为了解决什么问题
单表
表结构
create table stu ( sid int(4) primary key, sname varchar(20) not null, phone int(11) not null, addr varchar(20) not null, class_id int(4) not null, grade_id int(4) not null );
explain结果
explain select sid from stu where grade_id in(2,3) and class_id=1 order by grade_id desc ;
多表
链接(https://www.cnblogs.com/uncleyong/p/14758383.html)中第28题,
自己先写sql,然后做优化
最新原文:https://www.cnblogs.com/uncleyong/p/14805395.html