首先,可以先读一下这个sql。
SELECT ei.tag ,ei.difficulty ,
ROUND((SUM(score)-(MAX(score)+MIN(score)))/(COUNT(score)-2),1) AS clip_avg_score from exam_record as er
JOIN
examination_info as ei
USING
(exam_id)
WHERE
tag ='sql' and difficulty ='hard';
1.可以使用using,两个表连接得条件
2.最重要还是聚合函数的使用,round(),max(),min(),count()
3.就是审题一定要清楚,养成自己的思维习惯,对以后编写sql有很大的帮助!!!

京公网安备 11010502036488号