问题
单项选择题
设有关系模式SC(sno,cno,grade),查询既选修了c1又选修了c2课程的学生学号,正确的SQL命令是
A.SELECT sno FROM sc WHERE cno=“c1”AND cno=“c2”
B.SELECT sno FROM sc WHERE cno=“c1”AND SELECT sno FROM sc WHERE cno=“c2”
C.SELECT sno FROM sc WHERE cno=“c1”UNION SELECT sno FROM sc WHERE cno=“c2”
D.SELECT sno FROM sc WHERE cno=“c1”AND sno IN(SELECT sno FROM sc WHERE cno=“c2”)
答案
参考答案:D
解析:【解析】A)只是选择出了只选修了C1或只选修了C2的学生学号;B)选项格式不对;C)选项等价于A)选项。所以只有D)是正确的选项,符合题意。