1

这是我的查询

SELECT S.sid,
           S.sname,
           M.major
FROM Student S,
     Major M
     WHERE NOT EXISTS(
               (SELECT C.cno
                FROM Courses C
                WHERE S.sid = M.sid
                  AND M.dname = C.dname) EXCEPT
               (SELECT E.cno
                FROM Enroll E
                WHERE S.sid = M.sid
                  AND S.sid = E.sid
                  AND M.dname=E.dname))

为什么我在排队时收到 Invalid SQL: ORA-00907: missing right parenthesis 错误?

4

1 回答 1

3

EXCEPT是一个 SQLServer 子句,在 oracleMINUS中用于相同的:试试这个:

SELECT S.sid,
     S.sname,
     M.major
FROM Student S,
     Major M
WHERE NOT EXISTS(
     (SELECT C.cno FROM Courses C WHERE S.sid = M.sid AND M.dname = C.dname
     )
MINUS
     (SELECT E.cno
     FROM Enroll E
     WHERE S.sid = M.sid
      AND s.sid  = e.sid
      and m.dname=e.dname
     ));
于 2013-10-15T03:48:25.873 回答