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--
How to implement an intercept string function in MySQL? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Function:
1. Intercept the string from the left
Left (str, length)
Description: left (intercepted field, intercepted length)
Example: select left (content,200) as abstract from my_content_t
2. Intercept the string from the right
Right (str, length)
Description: right (intercepted field, intercepted length)
Example: select right (content,200) as abstract from my_content_t
3. Intercept the string
Substring (str, pos)
Substring (str, pos, length)
Description: substring (intercepted field, which bit to intercept)
Substring (intercepted field, which bit to intercept, intercept length)
Example: select substring (content,5) as abstract from my_content_t
Select substring (content,5200) as abstract from my_content_t
(note: if the number of digits is negative, such as-5, it is the length from the last digit to the end of the string or truncated.)
4. Intercept a string by keyword
Substring_index (str,delim,count)
Description: substring_index (intercepted fields, keywords, number of keyword occurrences)
Example: select substring_index ("blog.chinabyte.com", "." , 2) as abstract from my_content_t
Results: blog.chinabyte
(note: if the number of times the keyword appears is negative, such as-2, it is reciprocal from the back to the end of the string)
Results: chinabyte.com
After reading the above, have you mastered how to implement an intercept string function in MySQL? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.