当前位置:网站首页>MySQL interception_ MySQL method for intercepting strings [easy to understand]
MySQL interception_ MySQL method for intercepting strings [easy to understand]
2022-07-01 09:50:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
1、 Intercept the string from the left
left(str, length)
explain :left( Intercepted field , Interception length )
example :select left(content,200) as abstract from my_content_t
2、 Intercept the string from the right
right(str, length)
explain :right( Intercepted field , Interception length )
example :select right(content,200) as abstract from my_content_t
3、 Intercepting string
substring(str, pos)
substring(str, pos, length)
explain :substring( Intercepted field , Starting from the first few )
substring( Intercepted field , Starting from the first few , Interception length )
example :select substring(content,5) as abstract from my_content_t
select substring(content,5,200) as abstract from my_content_t
( notes : If the number of digits is negative Such as -5 It's the last digit , The length to the end of a string or the length to be intercepted )
4、 Intercept string by keyword
substring_index(str,delim,count)
explain :substring_index( Intercepted field , keyword , The number of times keywords appear )
example :select substring_index(”blog.chinabyte.com”,”.”,2) as abstract from my_content_t
result :blog.chinabyte
( notes : If the number of times a keyword appears is negative Such as -2 It's counting backwards , To the end of the string )
result :chinabyte.com
The intercepted string is 15,151,152,16’, It can be seen as ip Well ( Although this does not mean iP),
Then I'm going to intercept the part before each comma
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/131770.html Link to the original text :https://javaforall.cn
边栏推荐
- Click the screen with your finger to simulate F11 and enter the full screen
- Using closures to implement private variables
- The market is relatively weak recently
- SQL learning notes (02) - database table operation
- 关于OpenCV中图像的widthStep
- 富文本实现插值
- Closure implementation iterator effect
- Unity tips for reducing the amount of code -- empty protection extension
- 嵌入式开发用到的一些工具
- scratch大鱼吃小鱼 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月
猜你喜欢

Can you afford to buy a house in Beijing, Shanghai, Guangzhou and Shenzhen with an annual salary of 1million?

嵌入式开发用到的一些工具

Meituan P4 carefully collated microservice system architecture design manual to see the world of microservice architecture
![Problems caused by delete and delete[]](/img/d9/a1c3e5ce51ef1be366a973aa42d1f0.png)
Problems caused by delete and delete[]

JS prototype chain

Swag init error: cannot find type definition: response Response

The latest masterpiece of Alibaba, which took 182 days to produce 1015 pages of distributed full stack manual, is so delicious

Introduction to expressions and operators in C language

项目必用的全局异常处理器,你学会了吗

SQL learning notes (01) - basic knowledge of database
随机推荐
121. thread scheduling: join() method and yield() method
谁拥有穿越周期的眼光?
UE small knowledge point controller possess pawn process
BSN long story 10: how to ensure the safety of NFT
Unity tips for reducing the amount of code -- empty protection extension
[unity shader] substitution of bool type in the property definition
Strange, why is the ArrayList initialization capacity size 10?
JS原型链
4hutool实战:DateUtil-格式化时间[通俗易懂]
【无标题】
Initial experience of Flink, a mainstream real-time stream processing computing framework
Problems caused by delete and delete[]
Some tools used in embedded development
新数据库时代,不要只学 Oracle、MySQL
Network partition notes
“中移链”国密引擎在BSN正式上线
SQL learning notes (02) - database table operation
主流实时流处理计算框架Flink初体验
一个悄然崛起的国产软件,低调又强大!
Differences between JS valueof and toString