-選擇列表中的列 'Student.sname' 無效,因?yàn)樵摿袥]有包含在聚合函數(shù)或 GROUP BY 子句中。
SELECT Student.sno,sname,AVG(grade) AS avg_g
FROM Student,SC www.jb51.net
WHERE Student.sno=SC.sno AND cno>'008'
GROUP BY Student.sno --沒加 Student. 列名 'sno' 不明確。
HAVING MIN(grade) >= 60
ORDER BY avg_g DESC;
/*
把對(duì)Student表和Course表的全部權(quán)限授予用戶U2和U3
GRANT ALL PRIVILIGES www.jb51.net
ON TABLE Student, Course
TO U2, U3;
把對(duì)表SC的查詢權(quán)限授予所有用戶
GRANT SELECT ON TABLE SC
TO PUBLIC;
把查詢Student表和修改學(xué)生學(xué)號(hào)的權(quán)限授給用戶U4
GRANT UPDATE(Sno), SELECT
ON TABLE Student TO U4;
把用戶U4修改學(xué)生學(xué)號(hào)的權(quán)限收回
REVOKE UPDATE(Sno) ON TABLE Student FROM U4;
*/