任务描述
本关任务:根据提供的表和数据,查询选修“张三”老师所授课程的学生中,成绩最高的学生信息(具体输出信息请查看测试说明)及其成绩。
student
表数据:
s_id | s_name | s_sex |
---|---|---|
01 | Mia | 女 |
02 | Riley | 男 |
03 | Aria | 女 |
04 | Lucas | 女 |
05 | Oliver | 男 |
06 | Caden | 男 |
07 | Lily | 女 |
08 | Jacob | 男 |
course
表数据:
c_id | c_name | t_id |
---|---|---|
01 | Chinese | 02 |
02 | Math | 01 |
03 | English | 03 |
teacher
表数据:
t_id | t_name |
---|---|
01 | 张三 |
02 | 李四 |
03 | 王五 |
score
表部分数据:
s_id | c_id | s_score |
---|---|---|
01 | 01 | 80 |
01 | 02 | 90 |
01 | 03 | 99 |
02 | 01 | 70 |
... | ... | ... |
相关知识
略
编程要求
请仔细阅读右侧代码,根据方法内的提示,在Begin - End
区域内进行代码补充。
测试说明
补充完代码后,点击测评,平台会对你编写的代码进行测试,当你的结果与预期输出一致时,即为通过。
预期输出:
+------+--------+-------+---------+------+--------+
| s_id | s_name | s_sex | s_score | c_id | c_name |
+------+--------+-------+---------+------+--------+
| 01 | Mia | 女 | 90 | 02 | Math |
+------+--------+-------+---------+------+--------+
#请在此添加实现代码 ########## Begin ########## select a.*,b.s_score,b.c_id,c.c_name from student a INNER JOIN score b ON a.s_id = b.s_id INNER 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'); ########## End ##########