如果对关系执行下面的SQL语句:SELECT[’sno,AVG(grade)AS‘平均成绩’FROM scoreGROUP BY sno HAVING AVG(grade)>=85,对此结果的正确描述是——。
A.查找平均成绩在85分以上的学生
B.查找score表中各科成绩在85分以上的学生
C.查找score表中平均成绩在85分以上的学生的学号和平均成绩
D.查找score表中各科成绩在85分以上的学生的学号和平均成绩
第1题:
学生选课关系模式为SC(Sno,Cno,Grade),其中Sno为学号,Cno为课程号,Grade为成绩,SQL查询语句如下:
SELECT Sno
FROM SC SCX
WHERE NOT EXISTS
(SELECT *
FROM SC SCY
WHERE SCY.Sno='1042' AND NOT EXISTS
(SELECT *
FROM SC SCZ
WHERE SCZ.Sno=SCX.Sno AND SCZ.Cno=SCY.Cno));
与该查询等价的元组演算表达式为{t|(54)(Sc(u)∧SC(v)∧(55)∧t[1] =u[1])。
A.
B.
C.
D.
第2题:
17、下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“找出每个学生超过他选修课程平均成绩的课程号”。
A.SELECT Sno,Cno FROM SC x WHERE Grade >=(SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)
B.SELECT Sno,Cno FROM SC x WHERE (SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)<=Grade
C.SELECT Sno,Cno FROM SC WHERE Grade >=(SELECT AVG(Grade) FROM SC )
D.SELECT x.Sno,x.Cno FROM SC x, SC y WHERE y.Sno=x.Sno AND x.Grade >=(SELECT AVG(Grade) FROM y)
第3题:
26、下列SQL语句中,_________可以在“学生-课程”数据库正确实现“将学生的学号及他的平均成绩定义为一个视图”。
A.CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SC GROUP BY Sno;
B.CREAT VIEW S_G(Sno,AVG(Grade)) AS SELECT Sno,AVG(Grade) FROM SC GROUP BY Sno;
C.CREAT VIEW S_G AS SELECT Sno,AVG(Grade) FROM SC GROUP BY Sno;
D.CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SC ORDER BY Sno;
第4题:
设学生选课关系模式为SC(Sno,Cno,Grade),其中,Sno为学号,Cno为课程号, Grade为成绩,SQL查询语句如下:
SELECT Sno
FROMSC SCX
WHERE NOT EXISTS
(SELECT*
FROM SC SCY
WHERE SCY.Sno='1042'AND NOT EXISTS
(SELECT *
FROMSCSCZ
WHERE SCZ.Sno=SCX.Sno AND SCZ.Cno=SCY.Cno));与该查询等价的元组演算表达式为{t|(13)(SC(u)∧SC(v)∧(14)∧t[1]= u[1])}。
A.
B.
C.
D.
第5题:
统计选修课的学生总数和考试的平均成绩
A.select count(distinct(sno)) as 学生总数,avg(grade) as 平均成绩 from sc
B.select count(sno) as 学生总数,avg(grade) as 平均成绩 from sc
C.select count(sno) as 学生总数,avg(grade) as 平均成绩 from sc group by sno
D.select distinct count(sno) as 学生总数,avg(grade) as 平均成绩 from sc