有一张表SC,结构如下。SNO代表学号,CNO代表课程号,GRADE代表成绩。SNO CNO GRADE
3001 1 93
3001 2 84
3001 3 84
3002 2 83
3002 3 93
1042 1 84
1042 2 82现要查询至少选修了课程号为“1”和“3”的学生号,我已经知道可以用这样的语句求得:
select a.sno
  from sc a, sc b
 where a.sno = b.sno
   and a.cno = 1
   and b.cno = 3;现在有两个问题:
1,我想用含有not exists子句的SQL语句,如下所示。但是这个语句是错误的,我想知道我错在哪里?
select a.sno
  from sc a
 where not exists (select 1
          from sc b
         where b.cno in (1, 3)
           and not exists (select 1
                  from sc c
                 where c.sno = b.sno
                   and b.cno = a.cno));2,关系代数的形式写成这样对吗?(Π和Σ是大写的pi和sigma)
Πsno,cno(SC)÷Πcno(Σcno='1' ∨ cno='3'(SC));