问题 问答题

[说明]
根据下面所给的AAA数据库,或者按照下列所给的每条SQL查询语句写出相应的功能,或者按照下列所给的每种功能写出相应的SQL查询语句。
假设使用名称为AAA的数据库,它包括Students(学号char(8),姓名varchar(8),年龄 int,专业varchar(20),入学日期Date Time)和Score(学号char(8),课程名varchar(10),成绩 numeric(5,2))两张表。

[问题3]
请说出该程序段的功能。
declare @e numeric(5,2)
declare @ c1 int, @ c2 int, @ c3 int, @ c4 int
set @ c1=0; set @ c2 =0; set @ c3=0; set @ c4=0
declare xxx cursor
for select 成绩 from score
open xxx
fetch xxx into @ c
while @’@ fetch_status = 0
begin
if(@c > =90) set @cl =@ e1 +1;
else if( @ c > =70) set @ c2 =@ c2 +1;
else if(@ c> =60) set @ c3 =@ c3 +1;
else set @ c4 = @ c4 + 1
fetch from xxx into @ c
end
close xxx
deallocate xxx
print 优秀生人数:’+sb(@ c1,5);
print食好生人数:’+str(@ c2,5);
print及格生人数:’+str(@ c3,5);
print及格生人数:’+sh(@ c4,5)

答案

参考答案:该程序段功能:从score表中按成绩统计并显示出优秀、良好、及格、不及格各多少人。

填空题
单项选择题