急!求教:用数据库编个求学生平均成绩的程序~~

对每系或每班各科成绩进行分析(即求单科平均成绩、及格率和优秀率、各分数段的人数)

1.select avg(成绩列名) from 表名

2.select (select count(*) from 表名 where 成绩列名>60 and 科目列名=‘科目')/ (select count(*) from 表名)(假设60分及格)

3.select (select count(成绩列名) from 表名 where 成绩列名>80 and 科目列名=‘科目')/ (select count(*) from 表名)(假设80分为优秀)

4.select count(*) from 表名 where 成绩>80 and 成绩<90 where科目列名=‘科目'
(查询成绩在80-90分的所有人数)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-01-18
select count(*) from 表名 where 成绩>80 and 成绩<90 where科目列名=‘科目'
这样也行?