以下哪条语句可以实现查询选了课的学生人数( )。
A: select count(*) from sc
B: select count(sno) from sc
C: select count(distinct sno) from sc
D: select count(cno) from sc
A: select count(*) from sc
B: select count(sno) from sc
C: select count(distinct sno) from sc
D: select count(cno) from sc
举一反三
- 以下SQL语句中,____________可以在“学生-课程”数据库正确实现“查询选修了课程的学生总人数”。 A: SELECT COUNT(Sno)FROM SC B: SELECT COUNT(DISTINCT Sno)FROM SC C: SELECT COUNT(*)FROM SC D: SELECT SUM(Sno)FROM SC
- 在学生选课数据库中有学生表student(sno,sname,ssex,sage,sdept),课程表course(cno,cname)及学生选课表sc(sno,cno,grade),其中sno是学号,sname是姓名,ssex是性别,sage是年龄,sdept是系别,cno是课程号,cname是课程名,grade是成绩。以下哪条语句可以实现查询选了课的学生人数( )。 A: select count(*) from sc B: select count(sno) from sc C: select count(distinct sno) from sc D: select count(cno) from sc
- 下列查询语句中,错误的是()。 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
- 查询选修了数学课(课程号为2)的学生人数,可以使用的查询语句是: 。 A: SELECT MAX(*) FROM SC WHERE Cno = 2; B: SELECT AVG(Sno) FROM SC WHERE Cno = 2; C: SELECT COUNT(*) FROM SC WHERE Cno = 2; D: SELECT COUNT(Sname) FROM SC WHERE Cno = 2;
- 若要求“查询选修了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