I came across one SQL query in sqitch db schema management tool which is as follows:
BEGIN;
select subject , comment , timestamp
from tutorial.video
where false;
ROLLBACK;
Above query is part of verify strategy; What is interpretation or application of where false; in above query?
It is a where condition to be used when the query should not return any result.
Some DBMS supporting boolean values, Postgres for example, works with that instead of the classic where 1=1
.
Basically, where false
is the same as where 1=0
.
As far as I can tell it's to make you always get back 0 results. Same as doing something like where 1=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With