1. 找出没有购买红色零件的工程的工程号。
select JNO from SPJ where PNO not in (select PNO from P where COLOR='RED')2. 找出购买所有红色零件的工程的工程号。select JNO from SPJ where PNO in (select PNO from P where COLOR='RED')
select JNO from SPJ where PNO not in (select PNO from P where COLOR='RED')2. 找出购买所有红色零件的工程的工程号。select JNO from SPJ where PNO in (select PNO from P where COLOR='RED')
select jno from j where (select jno from spj where pno in (select pno from p where color='red'))
select JNO from SPJ where PNO not in (select PNO from P where COLOR='RED')2. 找出购买所有红色零件的工程的工程号。select JNO from SPJ where PNO in (select PNO from P where COLOR='RED')
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color<>'红色')2. 找出购买所有红色零件的工程的工程号。
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color='红色')
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color<>'红色')2. 找出购买所有红色零件的工程的工程号。
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color='红色')
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color<>'红色')2. 找出购买所有红色零件的工程的工程号。
select sno from j inner join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color='红色')
where spj.pno in(select pno from p where color<>'红色')2 select sno from j join spj on j.jno=spj.jno
where spj.pno in(select pno from p where color='红色')
where p.color<>'red'2,1,select spj.pno from spj inner join P on spj.pno=p.pno
where p.color='red'
select JNO from J where JNO not in
(select JNO from SPJ A left join P on A.PNO = P.PNO where P.COLOR = '红色')
select JNO from SPJ A where not exists
(select PNO from P where P.COLOR = '红色' and PNO not in (select PNO from SPJ where JNO = A.JNO))