以下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
A: SELECT COUNT(Sno)FROM SC
B: SELECT COUNT(DISTINCT Sno)FROM SC
C: SELECT COUNT(*)FROM SC
D: SELECT SUM(Sno)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语句中,_____________可以在“学生-课程”数据库正确实现“查询学生201215012选修课程的总学分数”。 A: SELECT COUNT(Ccredit)FROM SC, CourseWHER Sno='201215012' B: SELECT COUNT(Ccredit)FROM SC, CourseWHER Sno='201215012' AND SC.Cno=Course.Cno C: SELECT SUM(Ccredit)FROM SC, CourseWHER Sno='201215012' D: SELECT SUM(Ccredit)FROM SC, CourseWHER SC.Cno=Course.Cno AND Sno='201215012'
- 若要求“查询选修了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: 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
- 在学生选课数据库中,查询选修了课程的学生的学号、姓名,SQL语句可为( ) A: SELECT DISTINCT Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno; B: SELECT Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno; C: SELECT DISTINCT Sno, DISTINCT Sname FROM Student WHERE Student.Sno IN (SELECT Sno FROM SC); D: SELECT Sno, Sname FROM Student WHERE Student.Sno IN (SELECT DISTINCT Sno FROM SC);