题解 | #找出每个学校GPA最低的同学#
找出每个学校GPA最低的同学
https://www.nowcoder.com/practice/90778f5ab7d64d35a40dc1095ff79065
每个学校 gpa 最低
1.不动其他字段的基础上,增加一列,学校分组,取 gpa 最小值,想到窗口函数;
2.用聚合函数和排名函数都可,这里用聚合函数
select device_id
,university
,gpa
from
(select *,
min(gpa) over(partition by university) as min_gpa
from user_profile) as a
where gpa=min_gpa
order by university asc#SQL面试#
