题解 | #查找GPA最高值#
查找GPA最高值
https://www.nowcoder.com/practice/4e22fc5dbd16414fb2c7683557a84a4f
select gpa from (select university, gpa, rank()over(partition by university order by gpa desc) as posn from `user_profile` where university='复旦大学' ) rank_user where posn=1
利用窗口函数 rank()over()对各个大学的GPA进行降序排序,基于排序结果搜索排名为第一的结果
select max(gpa) as gpa from `user_profile` where university='复旦大学'
直接使用max()函数,获取最高值