【发布时间】:2020-04-04 12:50:52
【问题描述】:
问题:如果学生的平均分大于 80,则编写一个查询以显示学生 id 和平均分的列表(以小数点后 2 位显示)。将平均分的别名命名为 avg_mark。根据平均分对结果进行排序。
我写了这个查询,但结果与预期的输出不匹配。
select student_id, round(avg(value)) as avg_mark
from mark
where value>80 -------well this is wrong as I need to compare with an average of value
group by student_id
order by avg_mark
运行此查询会给出错误的输出 [链接如下]
谢谢!!!
【问题讨论】:
-
请仅使用您实际使用的数据库进行标记。