题目描述
https://www.nowcoder.com/practice/90778f5ab7d64d35a40dc1095ff79065
思路:如果直接用min(gpa)的话是得不到最小gpa对应的device_id数据的,所以使用窗口函数
row_number,partition by 选择按照university进行分区,order by 按照gpa进行排序
再取出第一行的数据
select device_id,university,gpa
from (
select *,
row_number() over(partition by university order by gpa asc) as rn
from user_profile
) as u
where rn=1