查询没有选修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' )
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' )
举一反三
- 下列SQL语句中,_________可以在“学生-课程”数据库正确实现“查询所有选修了1号课程的学生姓名”。 A: SELECT SnameFROM Student, SCWHERE SC.Cno= '1' B: SELECT SnameFROM Student, SCWHERE Student.Sno=SC.Sno AND SC.Cno= 1 C: SELECT Sname FROM Student WHERE Sno= (SELECT Sno FROM SC WHERE Cno= '1') D: SELECT Sname FROM Student WHERE EXISTS (SELECT * FROM SC WHERE Sno=Student.Sno AND Cno= '1')
- 下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“查询选修2号课程且成绩在90分以上的所有学生的学号和姓名”。 A: SELECT Sno, SnameFROM Student, SCWHERE Student.Sno = SC.Sno AND SC.Cno= ‘2’ AND SC.Grade > 90 B: SELECT Student.Sno, SnameFROM Student, SCWHERE Student.Sno = SC.Sno AND SC.Grade > 90 C: SELECT Sno, SnameFROM Student, SCWHERE SC.Cno= ‘2’ AND SC.Grade > 90 D: SELECT Student.Sno, SnameFROM Student, SCWHERE Student.Sno = SC.Sno AND SC.Cno= ‘2’ AND SC.Grade > 90
- 针对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 * FROM student WHERE sno IN (SELECT sno FROM sc WHERE cno='1'); B: SELECT sno, cno FROM SC x WEHRE grade>=(SELECT AVG(grade) FROM SC y WHERE y.sno = x.sno); C: SELECT sname FROM student WHERE EXISTS(SELECT * FROM sc WHERE sno=student.sno AND cno='1'); D: SELECT sname FROM student WHERE NOT EXISTS(SELECT * FROM course WHERE NOT EXISTS(SELECT * FROM sc WHERE sc.sno=student.sno AND sc.cno=course.cno));
- 以下命令是相关子查询的嵌套查询是: A: SELECT * FROM student WHERE sno IN (SELECT sno FROM sc WHERE cno = '1') B: SELECT * FROM student WHERE EXISTS (SELECT * FROM sc WHERE cno = '1' AND sc.sno = student.sno) C: SELECT sno, cno FROM sc x WHERE grade>(SELECT AVG(grade) FROM sc y WHERE y.sno = x.sno) D: 以上都是