In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to use the INSTR () function in MySQL, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
INSTR ()
The INSTR (str,substr) function returns the index position of the substring substr in the string str for the first time, and returns 0 if the substring is not found. For example:
Select INSTR ('MySQL string function', 'string') AS index1, INSTR ('MySQL string function', 'date') AS index2, INSTR ('MySQL string function','') AS index3, INSTR ('MySQL string function', null) AS index4;index1 | index2 | index3 | index4 |-+ 6 | 0 | 1 |
In addition, the LOCATE (substr,str) function can also be used to return the index position of the substring substr in the string str for the first time, the only difference from the INSTR (str,substr) function is that the parameters are in reverse order.
The LOCATE (substr,str,pos) function returns the index position where the substring substr first appears in the string str starting from the position pos, for example:
SELECT LOCATE ('sparkling MySQL Server', 5) AS ind;ind |-+ 7 |
FIELD (str,str1,str2,str3, …) The function returns the position of the string str in the subsequent string list, and 0 if it is not found. For example:
SELECT FIELD ('Li Si', 'Zhang San','Li Si', 'Wang Wu') AS ind;ind |-+ 2 |
The FIND_IN_SET (str,strlist) function returns the position of the string str in the list string strlist, where the strlist consists of N substrings separated by commas. For example:
SELECT FIND_IN_SET ('Li Si', 'Zhang San, Li Si, Wang Wu') AS ind;ind |-+ 2 | this is all the content of the article "how to use the INSTR () function in MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.