当前位置:网站首页>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
边栏推荐
- TC8:UDP_USER_INTERFACE_01-08
- 树莓派4B系统搭建(超详细版)
- A 419 error occurred in the laravel postman submission form. July 6th, 2020 diary.
- SQL learning notes (03) -- data constraint relationship
- JS variable lifting
- 关于OpenCV中图像的widthStep
- 吃一个女富豪的瓜。。。
- 年薪100万,在北上广深买的起房子吗?
- button按钮清除边框
- Can you afford to buy a house in Beijing, Shanghai, Guangzhou and Shenzhen with an annual salary of 1million?
猜你喜欢

持续进阶,软通动力稳步推动云智能战略

Network counting 01 physical layer

Apple amplification! It's done so well

LVGL V8.2字符串显示在Keil MDK上需要注意的事项(以小熊派为例)

Strange, why is the ArrayList initialization capacity size 10?

Initial experience of Flink, a mainstream real-time stream processing computing framework

Hardware midrange project

好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!

PHP code audit and File Inclusion Vulnerability

MapReduce programming basics
随机推荐
Ubuntu system installation and MySQL configuration
Mikrotik Routeros Internet access settings
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
PHP array functions (merge, split, append, find, delete, etc.)
Huawei accounts work together at multiple ends to create a better internet life
Dspic30f6014a LCD block display
Project procurement management
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
Some tools used in embedded development
IPv6 learning notes
Sd-wan notes
Clickhouse: Test on query speed of A-share minute data [Part 2]
渗透常用工具-Goby
Import and export of power platform platform sharepointlist
云原生到底是什么?它会是未来发展的趋势吗?
SQL学习笔记(03)——数据约束关系
SQL 化是 ETL 增量生产的第一步,这样的架构的核心能力是什么?
Strange, why is the ArrayList initialization capacity size 10?
Matrix and coordinates
JS prototype trap