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--
What this article shares with you is the example analysis of instr and find_in_set and regexp in Mysql. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
MySQL [interface_hd_com] > select * from tbl_name
+-+
| | dg_order_time |
+-+
| | 1 |
| | 1, 2, 3, 4 | |
| | 2pr 3pr 4 | |
| | 1 |
| | 2 |
+-+
5 rows in set (0.00 sec)
Instr displays the location of the substring you are looking for
Insrt: used to display the coordinates where they are located
Expr NOT REGEXP pat, expr NOT RLIKE pat
This is the same as NOT (expr REGEXP pat).
Expr REGEXP pat, expr RLIKE pat
Some of the characters that extend regular expressions are:
'.' Matches any single character.
Character class "[.]" Matches any character in square brackets. For example, "[abc]" matches "a", "b", or "c". To name the range of characters, use a "-". "[amurz]" matches any letter, while "[0-9]" matches any number.
"*" matches zero or more characters that precede it. For example, "x*" matches any number of "x" characters, "[0-9] *" matches any number of numbers, and ". *" matches any number of characters.
If the REGEXP pattern matches anywhere in the value under test, the pattern matches (unlike LIKE pattern matching, where the pattern matches only if it matches the entire value).
To locate a pattern so that it must match the beginning or end of the value being tested, use "^" at the beginning of the pattern or "$" at the end of the pattern.
Simple usage
MySQL [interface_hd_com] > select * from testtab
+-+
| | id |
+-+
| | 1 |
| | 1pr 2 |
| | 1, 2, 3, 4 | |
| | 1pr 2pr 3 |
| | 3pr 4pr 5 | |
+-+
5 rows in set (0.00 sec)
MySQL [interface_hd_com] > SELECT * FROM testtab where id regexp'1 | 2 | 3 | 4pm; # containing the string 1, 2, 2, 3, 4
+-+
| | id |
+-+
| | 1 |
| | 1pr 2 |
| | 1, 2, 3, 4 | |
| | 1pr 2pr 3 |
| | 3pr 4pr 5 | |
+-+
5 rows in set (0.00 sec)
The above is the example analysis of instr and find_in_set and regexp in Mysql. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.