why would you use WHERE 1=0 statement in SQL?

后端 未结 12 2180
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 00:48

I saw a query run in a log file on an application. and it contained a query like:

SELECT ID FROM CUST_ATTR49 WHERE 1=0

what is the use of s

12条回答
  •  庸人自扰
    2020-12-08 01:06

    Per user milso in another thread, another purpose for "WHERE 1=0":

    CREATE TABLE New_table_name as select * FROM Old_table_name WHERE 1 = 2;

    this will create a new table with same schema as old table. (Very handy if you want to load some data for compares)

提交回复
热议问题