Got it

SQL statement query table structure

Latest reply: Jul 31, 2019 12:48:39 423 1 10 0 0

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.


ncie
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.