题解 | 找出每个学校GPA最低的同学 (开窗函数)
找出每个学校GPA最低的同学
https://www.nowcoder.com/practice/90778f5ab7d64d35a40dc1095ff79065
select device_id,university,gpa from (
select device_id,university,gpa,
row_number() over(partition by university order by gpa) as rk
from user_profile)t1
where t1.rk=1
--因为多了一个device_id,不能用group by,所以用开窗函数
--开窗函数有一个限制就是必须都排序,不能去重
--所以我们就对排完序的表格进行过滤筛选就好了