我正在努力预测专业学生的平均GPA水平。
如果我不选择major
并将其遗漏,那么它就有效。
这就是我所拥有的:
SELECT MAX(avg_gpa), major
FROM (SELECT major, AVG(gpa) AS avg_gpa
FROM Student
GROUP BY major);
我的错误:ORA-00937:不是单组组功能
答案 0 :(得分:1)
SELECT
MAX(avg_gpa) as max_avg_gpa,
min(major) keep (dense_rank first order by avg_gpa desc) as best_major
FROM (
SELECT
major,
AVG(gpa) AS avg_gpa
FROM Student
GROUP BY major
)