嵌套的where子句,除了运算符要求右括号

时间:2017-04-24 10:24:41

标签: sql

我收到一条错误消息,说明缺少正确的括号。它希望我在使用except运算符

之前先在where子句中关闭my not exists语句

我的代码:

select S.ID, S.SNAME
from ENROLLMENT E, STUDENT S
where E.STUDENT = S.ID and E.COURSENUM = 310 and E.DEPT = 'MATH'
intersect
select S2.ID, S2.SNAME
from STUDENT S2
where not exists(
    select P.PCOURSENUM, P.DEPT
    from PREREQUISITE P
    where P.COURSENUM = 310 and P.DEPT = 'MATH'
    except
    select T.COURSENUM, T.DEPT
    from TRANSCRIPT T
    where T.STUDENT = S2.ID
)

0 个答案:

没有答案