请查出至少使用供应商S1供应的全部零件的工程名.

使用存在量词的SQL语句为:
select jname from j
where not exists
(select * from spj a
where sno='s1'
and not exists
(select * from spj
where j.jno=jno and a.pno=pno))
突然觉得使用ALL会更简单,于是又SQL语句如下:
select jname from j where jno in (select jno from spj where pno > all (select pno from spj temp where temp.sno = 's2'))
可是这个不对,请指点错误的地方,是否可以使用ALL,如果可以,正确的写法是?

第1个回答  2012-09-19
select jname from j where exists(select 1 from spj a where sno='s1' )