I've come across
create table new_table as select * from old_table where 1=2;
What is the meaning of the where 1=2
condition and what function does it perform?
1=2
always evaluates as false. This is a common trick to utilize the create as select to copy a table's structure without copying any of its rows (as none of them will pass the test of 1=2
).