-- 查询选修"张三"老师所授课程的学生中,成绩最高的学生信息及其成绩
select t5.*, t4.s_score as MAX_score, t4.c_id, t6.c_name from (score t4, student t5) right join course t6 on t6.c_id = t4.c_id where t4.s_score = ( select max(t3.s_score) from teacher t1, course t2, score t3 where t1.t_name = '张三' and t1.t_id = t2.t_id and t2.c_id = t3.c_id) and t4.s_id = t5.s_id
select a.*, b.s_score, b.c_id, c.c_name from student a left join score b on a.s_id = b.s_id left join course c on b.c_id = c.c_id where b.c_id =( select c_id from course c, teacher d where c.t_id = d.t_id and d.t_name = '张三') and b.s_score in ( select max(s_score) from score where c_id = '02')
-- 2019/05/05