• 2022-10-26
    ​下列SQL语句中,_________可以在“学生-课程”数据库正确实现“将学生的学号及他的平均成绩定义为一个视图”。‎
    A: CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
    B: CREAT VIEW S_G(Sno,AVG(Grade)) AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
    C: CREAT VIEW S_G AS SELECT Sno,AVG(Grade) FROM SCGROUP BY Sno;
    D: CREAT VIEW S_G(Sno,Gavg) AS SELECT Sno,AVG(Grade) FROM SCORDER BY Sno;
  • A

    举一反三

    内容

    • 0

      针对表SC(sno, cno, grade),其中sno为学号,cno为课程号,grade为成绩。以下哪个操作( )统计出每位学生所选课程的最高分和最低分。 A: select sno,max(grade), min(grade) from sc B: select sno,max(grade), min(grade) from sc order by sno C: select sno,max(grade), min(grade) from sc group by sno D: select sno,avg(grade), sum(grade) from sc group by sno

    • 1

      关系SC(Sno,Cno,Grade)表示学号,课程号,成绩。现要查询平均分在90分以上的学生的学号和平均成绩,正确的语句是______。 A: SELECT Sno,AVG(Grad FROM SC WHERE AVG(Grad>=90 GROUP BY Sno B: SELECT Sno,AVG(Grad FROM SC GROUP BY Sno HAVING AVG(Grad>=90 C: SELECT Sno,AVG(Grad FROM SC WHERE AVG(Grad>=90 ORDER BY Sno D: SELECT Sno,AVG(Grad FROM SC GROUP BY Cno HAVING AVG(Grad>=90

    • 2

      ‍下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“找出每个学生超过他选修课程平均成绩的课程号”。‍ A: SELECT Sno,CnoFROM SC xWHERE Grade >=(SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno) B: SELECT Sno,CnoFROM SC xWHERE (SELECT AVG(Grade) FROM SC y WHERE y.Sno=x.Sno)<=Grade C: SELECT Sno,CnoFROM SC WHERE Grade >=(SELECT AVG(Grade) FROM SC ) D: SELECT x.Sno,x.CnoFROM SC x, SC yWHERE y.Sno=x.Sno AND x.Grade >=(SELECT AVG(Grade) FROM y)

    • 3

      ​下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“查询选修并成绩良好3门以上课程的学生学号及其满足条件的课程门数”。‌ A: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoHAVING Grade>=80 AND COUNT(*) >3 B: SELECT Sno,COUNT(*)FROM SCWHERE Grade>=80GROUP BY SnoHAVING COUNT(*) >3 C: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoWHERE Grade>=80HAVING COUNT(*) >3 D: SELECT Sno,COUNT(*)FROM SCGROUP BY SnoWHERE Grade>=80 AND HAVING COUNT(*) >3

    • 4

      已知关系模式:SC(sno,sname,grade),各属性含义依次为学号、课程名、分数。要查找“数据库”课分数最高的学生的学号,正确的SQL语句是( )。 A: SELECT sno FROM sc WHERE sname="数据库"AND grade=MAX(grade) B: SELECT sno FROM sc FOR sname="数据库"OR grade>=MAX(grade) C: SELECT sno FROM sc WHERE sname="数据库"AND grade=(SELECT MAX(grade)FROM sc) D: SELECT sno FROM sc FOR sname="数据库"OR grade=(SELECT MAX(grade)FROM s