Shane Dev wrote:
> Apart from visual inspection and testing, is there anyway to be sure your
> query selects the same results as my query?

Can I interest you in things like relational algebra or tuple calculus?
;-)

>>> select * from nodes where not exists (select * from edges where 
>>> child=nodes.id);
>>  select * from nodes where id not in (select child from edges);
>
> From https://sqlite.org/queryplanner.html "When programming in SQL you tell
> the system what you want to compute, not how to compute it". Is this an
> exception to the rule where the query planner must be told how to compute
> the result?

Arguable, the second query is on a higher abstraction level, i.e., the
_first_ one tells the system how to compute it.  (AFAIK SQLite is able
to transform an IN lookup into a correlated subquery, if worthwhile, but
not in the opposite direction.)


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to