Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试按专业预测学生的最高平均 GPA。
如果我不选择major并忽略它,它会起作用。
major
这就是我所拥有的:
SELECT MAX(avg_gpa), major FROM (SELECT major, AVG(gpa) AS avg_gpa FROM Student GROUP BY major);
我的错误:ORA-00937: not a single-group group function
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 )