第一个的写法很多。
全嵌套的写法:
select jname from j where jno in (select jno from spj where sno in (select sno from s where city='上海'))
关联写法:
select j.jname from s,j,spj where s.sno=spj.sno and j.jno=spj.jno and s.city='上海'
第二个最简单的写法就是把所有的工程名减去用了天津生产零件的工程名:
select jname from j
except
select jname from j where jno in (select jno from spj where sno in (select sno from s where city='天津'))