问题 单项选择题

第(31)到(35)题中使用的3个数据表:“学生”表、“课程”表和“成绩”表的结构如下:
“学生”表:学号C(8),姓名C(8),性别C(2),系名(10),出生日期D
“课程”表:课程编号C(4),课程名称C(12),开课系名C(10)
“成绩”表:学号C(8),课程编号C(4),成绩Ⅰ

检索每门课程的总分,查询结果中包括课程名和总分,正确的命令是( )。

A.SELECT 课程名称,COUNT (成绩) AS 总分 FROM 课程,成绩;WHERE 课程.课程编号=成绩.课程编号;ORDER BY 成绩.课程编号

B.SELECT 课程名称,COUNT(成绩) AS 总分 FROM 课程,成绩;WHERE 课程.课程编号=成绩.课程编号;GROUP BY 成绩.课程编号

C.SELECT 课程名称,SUM (成绩) AS 总分FROM 课程,成绩:WHERE 课程.课程编号=成绩.课程编号;ORDER BY成绩.课程编号

D.SELECT 课程名称,SUM(成绩) AS 总分FROM 课程,成绩;WHERE 课程.课程编号=成绩.课程编号;GROUP BY 成绩.课程编号

答案

参考答案:D

解析: 进行SQL简单计算查询时,还可以加上GROUP BY子句进行分组计算查询。 通常来说,一个计算函数的范围是满足WHERE子句指定条件的所有记录。当加上GROUP BY子句后,系统会将查询结果按指定列分成集合组。当一个计算函数和一个GROUP BY子句一起使用时,计算函数的范围变为每组所有的记录。 本题通过“GROUP BY成绩.课程编号”可以先将记录按“课程编号”分组,然后再通过函数“SUM(成绩) AS总分”对每组记录求和,其中,通过AS短语可以对进行计算的字段指定一个新的字段名。另外,COUNT ()函数是记数函数,ORDER BY 是对查询结果进行排序的短语。

完形填空
完型填空(共20小题;每小题1。5分,满分30分)
Every human being,  36 what he is doing, gives off body heat. The usual problem is  37 dispose of it. But the designers of the Johnstown campus of the University of Pittsburgh set themselves the  38 problem — how to collect body heat. They have designed a collection system which utilizes  39 body heat, but the heat given off by such objects  40 light bulbs and refrigerators as well. The system works so well  41 no conventional fuel is needed  42 the campus’ six buildings comfortable.
Some parts of most modern buildings — theatres and offices  43 classrooms — are more than amply heated by people and lights and sometimes must be air-conditioned  44 in winter. The technique of  45 heat and redistributing it is  46 “heat recover”. A few modern buildings recover  47 , but the university’s system is the first to recover heat  48 some buildings and re-use it in  49 . Along the way, Pitt has learned a great deal about some of its heat producers. The  50 a student studies, the more heat his body  51 . Male students emit more heat than 52 students, and the larger a student, the more heat he  53 . It is tempting to  54 that the hottest prospect for the Johnstown campus would be a  55 , over-weight male genius.
小题1:
A.thoughB.no matterC.howeverD.in spite of
小题2:
A.how toB.howC.whatD.what to
小题3:
A.similarB.wrongC.opposingD.opposit
小题4:
A.bothB.not onlyC.as well asD.neither
小题5:
A.for exampleB.likeC.ofD.as
小题6:
A.whichB.thenC.thatD.therefore
小题7:
A.makeB.to be madeC.to makeD.making
小题8:
A.includingB.as well asC.withD.as well
小题9:
A.evenB.soC.everD.much
小题10:
A.savingB.being savedC.disposingD.being disposed
小题11:
A.talkedB.thoughtC.suggestedD.called
小题12:
A.lossB.coldC.temperatureD.heat
小题13:
A.toB.fromC.withD.for
小题14:
A.the otherB.otherC.othersD.the others
小题15:
A.hardB.hardestC.harderD.more hard
小题16:
A.takes inB.gives offC.gives inD.takes out
小题17:
A.otherB.femaleC.girlD.boy
小题18:
A.producesB.manufacturesC.designsD.assembles
小题19:
A.startB.concludeC.endD.begin
小题20:A. easy-going   . fun-making  C.hard-working  D. good-for-nothing
单项选择题