题解 | #找出每个学校GPA最低的同学#右连接

找出每个学校GPA最低的同学

https://www.nowcoder.com/practice/90778f5ab7d64d35a40dc1095ff79065

select a.device_id, b.university, b.gpa
from user_profile a
right join (
    select university, min(gpa) as gpa
    from user_profile
    group by university
) as b
on a.university = b.university and a.gpa = b.gpa
order by university;

全部评论
刚开始我直接使用group by分组,发现device_id与min(gpa)对应不起来
点赞 回复 分享
发布于 2023-07-31 15:58 江苏

相关推荐

求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务