有关系S(SNO, SNAME, SDEPT,SAGE),C(CNO, CNAME),SC(SNO, CNO, GRADE)。其中SNO是学生号,SNAME是学生姓名,SDEPT是系别,SAGE是学生年龄,CNO是课程号,CNAME是课程名称,GRADE是成绩。要查询“计算机”系的没有不及格成绩的学生学号和姓名
A. SELECT Sno, Sname FROM S WHERE Sdept='计算机’ INTERSECT SELECT Sno, Sname FROM SC WHERE GRADE>=60;
B. SELECT Sno, Sname FROM S WHERE Sdept='计算机’ and Sno not in (SELECT SNO FROM SC WHERE GRADE<60);
C. SELECT Sno, Sname FROM S WHERE Sdept='计算机’ EXCEPT SELECT SNO FROM SC WHERE GRADE<60;
D. SELECT Sno, Sname FROM S WHERE Sdept='计算机’ and SNO in (SELECT SNO FROM SC WHERE GRADE>=60);
参考答案: B
解析:第一步先查询成绩不及格的学生学号:SELECT SNO FROM SC WHERE GRADE<60;将第一步的查询结果作为筛选条件,第二步再查询满足条件的记录,即“计算机”系且成绩及格的学生学号和姓名,因此正确答案为B选项。