题解 | 查找GPA最高值
查找GPA最高值
https://www.nowcoder.com/practice/4e22fc5dbd16414fb2c7683557a84a4f
select max(gpa) as gpa from user_profile where university='复旦大学';
- 限定条件:复旦大学学生,
university='复旦大学'
; - gpa最高值:max(gpa);当然也可以按gpa降序排序,取第一名
细节问题:
- 表头重命名:as
完整代码:
'''
# 方法1
# selectmax(gpa) asgpa
# fromuser_profile
# whereuniversity='复旦大学';
# 方法2
selectgpa
fromuser_profile
whereuniversity='复旦大学'
orderbygpa desclimit 1
'''