基于"学生-选课-课程"数据库中的三个关系:
S(S#,SNAME,SEX,BIRTHYEAR,DEPT),主码为S#
C(C#,CNAME,TEACHER),主码为C#
SC(S#,C#,GRADE),主码为(S#,C#)
查找"选修了C01号课程的全体学生的姓名和所在的系", 下列SQL语句中哪一个是错误的?
- A.SELECT SNAME, DEPT FROM S WHERE S# IN (SELECT S# FROM SC WHERE C# ='C01');
- B.SELECT SNAME, DEPT FROM S WHERE S# = (SELECT S# FROM SC WHERE C# ='C01');
- C.SELECT SNAME, DEPT FROM S, SC WHERE C# ='C01' AND S.S# = SC.S#;
- D.SELECT SNAME, DEPT FROM (S JOIN SC ON S.S# = SC.S#) WHERE C# ='C01';
热度🔥369
解析:打开微信小程序查看本题解析