MySqllike query conversion method (like query is not required) bitsCN.com
Select * from account where userName like 'AD % '; select * from account where userName> = 'AD' and userName <' AE'
The results of these two queries are the same, and the efficiency seems to be similar. no specific efficiency test is conducted. if you are interested, you can test the efficiency.
In the like query, ad % is the data of userName starting with ad,
UserName> = 'ad' is used to query data starting with ad and also contains AE, af, ag ......, That is, to query data where "ad" contains d and is greater than d in "ad"
Therefore, and userName <'ad' ensures that the query interval is in "ad", while AE, af, ag ...... This data will not appear in the result set.
Of course, you can try:
Select * from account where userName> = 'AD' and userName <'Az ';
Does the result set contain: AE, af, ag ...... Ak, al ...... Data starting with ay and az.
Author: hoojo
Source:
Blog: http://blog.csdn.net/IBM_hoojo
The copyright of this article is shared by the author and the blog Park. You are welcome to repost this article. However, you must retain this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be held legally liable.
All rights reserved. For more information, see the source. This article is from:
All rights reserved. You are welcome to reprint it. please indicate the source for reprinting. thank you, bitsCN.com.