avatar
h*3
1
stu_name, class_id, time, grade
A 101 1 90
B 101 1 80
A 101 2 100
A 102 1 80
B 102 1 50
B 102 2 70
time 是第几次take这门课, assume一门课只能retake一次.
写SQL, 算出每门课average improvement for students.
翻出曾经收藏的这个题目,当时就没想清楚, 什么是 average improvement for
students. 那没重修过的酸有improvement么?
做过的给个hint吧? 谢谢.
avatar
x*p
2
You need to define what is "average improvement for students"
avatar
f*h
3
with FirstTime as(
select stu_name,classID,GradeOne
from t
where time=1
),
SecondTime as(
select stu_name,classID,GradeTwo
from t
where time=2
)
select avg(s.GradeTwo-f.GradeOne)
from FirstTime f,
SecondTime s
where f.stu_name=s.stu_name
and f.classID=s.classID
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。