A: SELECT Sno, COUNT(*) FROM SC GROUP BY Sno
B: SELECT Sno FROM SC GROUP BY Sno WHERE COUNT(*)> 3
C: SELECT Sno FROM SC GROUP BY Sno HAVING COUNT(*)> 3
D: SELECT Sno FROM SC GROUP BY Sno
举一反三
- 若要求“查询选修了3门以上课程的学生的学号”,正确的SQL语句是( ) A: SELECT sNo FROM SC GROUP BY sNo WHERE COUNT(*)> 3 B: SELECT sNo FROM SC GROUP BY sNo HAVING COUNT(*)> 3 C: SELECT sNo FROM SC ORDER BY sNo WHERE COUNT(*)> 3 D: SELECT sNo FROM SC ORDER BY sNo HAVING COUNT(*)> 3
- 下列查询语句中,错误的是()。 A: ASELECT Sno, COUNT(*) FROM SC GROUP BY Sno B: BSELECT Sno FROM SC GROUP BY Sno WHERE COUNT(*)> 3 C: CSELECT Sno FROM SC GROUP BY Sno HAVING COUNT(*)> 3 D: DSELECT Sno FROM SC GROUP BY Sno
- 针对学生选课表sc(sno, cno, grade),其中sno为学号,cno为课程号,grade为成绩。以下( )语句可查询选修了两门以上成绩在90分以上课程的学生学号。 A: select sno from sc where grade>90 group by sno having count(cno)>2; B: select sno from sc where grade>90 group by sno having count(*)>2; C: select sno from sc where grade>90 and count(*)>2 group by sno; D: select sno from sc where grade>90 group by sno having count(sno)>2;
- 在学生选课数据库中,查询平均成绩大于等于60分的同学,SQL语句为( ) A: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; B: SELECT Sno FROM SC WHERE Grade>=60 GROUP BY Sno; C: SELECT Sno, Grade FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; D: SELECT Sno FROM SC GROUP BY Sno HAVING Grade >=60;
- 在学生选课数据库中,查询平均成绩大于等于60分的同学,SQL语句为( ) A: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; B: SELECT Sno FROM SC WHERE Grade>=60 GROUP BY Sno; C: SELECT Sno, Grade FROM SC GROUP BY Sno HAVING AVG(Grade)>=60; D: SELECT Sno FROM SC GROUP BY Sno HAVING Grade >=60;
内容
- 0
如果想限制sc(sno,cno,grade)表中每人最多选三门课,如何用断言表示?sc(sno,cno,grade)表示选修(学号,课程号,成绩) A: Create assertion asse1 check(3>=all( select count(*) from sc group by sno)) B: Create assertion asse1 check(3>=any( select count(*) from sc group by sno)) C: Create assertion asse1 check(3>=some( select count(*) from sc group by sno)) D: Create assertion asse1 check(3>= select count(*) from sc group by sno)
- 1
基于“学生-选课-课程”数据库中的三个关系: 学生表S(SNO,SNAME,SEX,BIRTHYEAR,DEPT),主码为SNO 课程表C(CNO,CNAME,TEACHER),主码为CNO 选课表SC(SNO,CNO,GRADE),主码为(SNO,CNO) [br][/br]查找“选修了至少5门课程的学生的学号”,正确的SQL语句是( )。 A: SELECT SNO FROM SC GROUP BY SNO HAVING COUNT(*) >=5; B: SELECT SNO FROM SC GROUP BY SNO WHERE COUNT(*) >=5; C: SELECT SNO FROM SC HAVING COUNT(*) >=5; D: SELECT SNO FROM SC WHERE COUNT(*) >=5;
- 2
如果想限制sc(sno,cno,grade)表中每人最多选三门课,如何用断言表示?sc(sno,cno,grade)表示选修(学号,课程号,成绩) A: Create assertion asse1 check(3>=all( select count(*) from sc group by sno)) B: Create assertion asse1 check(3>=any( select count(*) from sc group by sno)) C: Create assertion asse1 check(3>=some( select count(*) from sc group by sno)) D: Create assertion asse1 check(3>= select count(*) from sc group by sno)
- 3
查询最低成绩大于85分的学生学号和平均成绩,可以使用的查询语句是: 。 A: SELECT Sno, AVG(Grade) FROM SC HAVING MIN(Grade) > 85 GROUP BY Sno; B: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING MIN(Grade) > 85; C: SELECT Sno, AVG(Grade) FROM SC WHERE MIN(Grade) > 85 GROUP BY Sno; D: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno WHERE MIN(Grade) > 85;
- 4
关系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