问题一: 首先对id建主键索引是应该的吧,然后性别和年龄重复性太大不适合建索引,然后电话是唯一的,适合建唯一索引,地址得看是什么地址了,宽泛的地址重复性也很大,姓名重复性应该不是太大,可以建个普通索引。 问题二: select student.name, student_score.score from student join student_score on student.class_id=1 and student.id=student_score.student_id and student_score.score>500; 班级和分数重复性太大不适合单独建索引,可以和student_id一起建个组合索引,on子句中student表中涉及到的列(student_id, class_id)建组合索引,student_score表中涉及的列(student_id,score)建组合索引
点赞 2

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务