题解 | #存在绩点大于该校平均绩点时的学生信息#

存在绩点大于该校平均绩点时的学生信息

https://www.nowcoder.com/practice/860fb125c6ac49b080766040f3bd902f

#求每个学校的平均绩点
#select university,avg(gpa) from user_profile group by university;
#select a.device_id,a.university,a.gpa,b.av
#from user_profile a
#join (select university,avg(gpa) av from user_profile group by university)
#b on a.university=b.university ;

select c.device_id,c.university
from (select a.device_id,a.university,a.gpa,b.av
from user_profile a
join (select university,avg(gpa) av from user_profile group by university)
b on a.university=b.university )c
where c.gpa>c.av and c.av>3.6 order by c.device_id desc;
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务