this is from a SQL playbook
i don't understand the logic of DIVIDE when you use more than one NOT EXISTS
such as this query
select distinct itemname from qdel del where not exists (select * from qspl
where not exists (select * from qitem where itemtype='n' and not exists
(select * from qdel where qdel.itemname=qitem.itemname
and qdel.splno=qspl.splno)) and not exists (select * from qdel
where qdel.itemname = del.itemname and qdel.splno=qspl.splno))
i don't understand how can NOT EXISTS code brings out the results of the existing rows in those not exists lines
like it says NOT EXISTS itemtype 'n' etc. but that is the results!
personally, i think the double negative (if there are no courses that the student did not take, then he musta took 'em all) is needlessly—and hopelessly—complex
i think in other words... students that took all the courses gets canceled out, leaving only them in the result.
it's still not totally clear in my head. but this is a simple way for me to make it more clear even if it's not really correct.