SQL statement query table structure
Advantages: The database overhead is small.
where 1=1 is the SQL statement condition logic judgment expression. Because 1=1 is set to true, the expression 1=1 always returns true. The actual purpose of this writing is to obtain the logical value "True". In fact, the logic value "True" can be returned in the 2=2, 1+2=3, '=', and so on, except that the operation cost of the 1=1 is smaller and therefore is most commonly used. The following examples will help to understand the concepts:
1) select * from t1 where 1=1;-- select * from t1 where true;--
2) select * from t1 where 1<>1;-- select * from t1 where false;--
Note: For example, 1) is equivalent to no filtering condition, and some snakes are added. The actual meaning of where 1=1 is not as useful as that of where 1<>1 (or where 1=0). When we only need to obtain the field (structure) information of the table, and do not need to pay attention to the actually saved records, for example, the format of 2) is very removable because the system reads only the structure information and does not read the specific table records into the memory. This saves the system overhead.