ASDV-SQL/Semester 2/SQL Hell pt5.txt

36 lines
856 B
Plaintext

/* list the supplier number and supplier name for suppliers who DO NOT supply any parts USE subqueries*/
select snumber
from supplier
where not exists
(select *
from spj
where spj.snumber = supplier.snumber);
/* list the supplier number and supplier name for suppliers who DO NOT supply any parts USE subqueries*/
select snumber
from supplier
where snumber in /* you may use a NOT in and and omit the FALSE at the end */
(select *
from spj
where spj.snumber = supplier.snumber) = false;
select snumber
from supplier
where snumber in
(select snumber from spj) = false;
/* AAAAAAAAAAAAAAAAAA */
select distinct snumber
from spj as c
where not exists
(select *
from project as a cross join spj as b
where c.snumber = b.snumber and not exists
(select *
from spj
where b.snumber=spj.snumber and a.jnumber = spj.jnumber))