题解 | #找出每个学校GPA最低的同学#
找出每个学校GPA最低的同学
https://www.nowcoder.com/practice/90778f5ab7d64d35a40dc1095ff79065
# 根据学校分组,组内根据gpa升序排列,将结果作为临时表 select device_id,university,gpa, row_number() over (partition by university order by gpa) c1 from user_profile # 通过子查询查临时表,过滤出每组排第一的数据,即每组gpa最低的数据,最后将结果根据 university 升序 select device_id,university,gpa from (select device_id,university,gpa, row_number() over (partition by university order by gpa) c1 from user_profile) t1 where c1 = 1 order by university;