This helps reformat it:
select sname from s
where not exists
(select * from p
where not exists
(select * from spj spjx
where s.sno = spjx.sno
and p.pno = spjx.pno));
Basically: select all sname from s, where no p exists, where there is no spj, so spj matches s and p. Think of each layer as a filter.
And the result looks like relational division, as Martin points out in a comment.
source
share