Search code examples
sqldatabasedatabase-migrationrdbmssqitch

Whats meaning of where false; in SQL query


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?


Solution

  • 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.