针对S_T数据库,查询既选修了1号课程又选修3号课程的学生学号,以下不正确的SQL命令是( )。
A: select snofrom scwhere cno='1' and cno='3'
B: select snofrom scwhere cno='1'intersectselect snofrom scwhere cno='3'
C: select snofrom scwhere cno='1' and sno in(select snofrom scwhere cno='3')
D: select a.snofrom sc a,sc bwhere a.sno=b.sno and a.cno='1' and b.cno='3'
A: select snofrom scwhere cno='1' and cno='3'
B: select snofrom scwhere cno='1'intersectselect snofrom scwhere cno='3'
C: select snofrom scwhere cno='1' and sno in(select snofrom scwhere cno='3')
D: select a.snofrom sc a,sc bwhere a.sno=b.sno and a.cno='1' and b.cno='3'
举一反三
- 查询没有选修1号课程的学生姓名()。 A: select snamefrom student,scwhere student.sno=sc.sno and cno!='1' B: select snamefrom sno not in(select snofrom scwhere cno='1' ) C: select snamefrom sno in(select snofrom scwhere cno!='1' ) D: select snamefrom sno not exists(select*from scwhere student.sno and sc.sno and cno='1' )
- 针对学生选课表sc(sno, cno, grade),其中sno为学号,cno为课程号,grade为成绩。以下()语句可查询选修了两门以上成绩在90分以上课程的学生学号。 A: select snofrom scwhere grade>;90group by snohaving count(cno)>;2 B: select snofrom scwhere grade>;90group by snohaving count(*)>;2 C: select snofrom scwhere grade>;90 and count(*)>;2group by sno D: select snofrom scwhere grade>;90group by snohaving count(distinct sno)>;2
- 下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“计算1号课程的学生平均成绩”。 A: SELECT AVG(Grade)FROM SCWHERE Cno= ' 1 ' B: SELECT MAX(Grade)FROM SCWHERE Cno= 1 C: SELECT MIN(Grade)FROM SCWHERE Cno= 1 D: SELECT AVG(Grade)FROM SCWHERE Cno= 1
- 针对学生选课表sc(sno, cno, grade),其中sno为学号,cno为课程号,grade为成绩。以下( )语句可查询选修了两门以上成绩在90分以上课程的学生学号。 A: select sno from scwhere grade>90group by snohaving count(cno)>2 B: select sno from scwhere grade>90group by snohaving count(*)>2 C: select sno from scwhere grade>90 and count(*)>2group by sno D: select sno from scwhere grade>90group by snohaving count(sno)>2
- 在MySQL中,假设有学生选课表SC(sno,cno,score)。那么列出所有选修课程超过5门的学生学号以及选修课程数目,其正确的SQL语句为()。 A: select sno,count(cno)from scwhere count(cno)>=5; B: select sno,count(cno)from scgroup by sno where count(cno)>=5; C: select sno,count(cno)from scgroup by sno having count(cno)>=5; D: select sno,count(cno)from scgroup by cno having count(cno)>=5;