当前位置:网站首页>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
边栏推荐
- Voice service notes
- Live broadcast management project
- 项目采购管理
- Strange, why is the ArrayList initialization capacity size 10?
- 硬件中台项目
- STM32逆变器电源设计方案,基于STM32F103控制器[通俗易懂]
- Can you afford to buy a house in Beijing, Shanghai, Guangzhou and Shenzhen with an annual salary of 1million?
- JS variable lifting
- [untitled]
- JS scope chain and closure
猜你喜欢

MapReduce programming basics

这样理解mmap,挺有意思!

SQL学习笔记(01)——数据库基本知识

Who has the vision to cross the cycle?

Upload labs for file upload - white box audit

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

Mikrotik Routeros Internet access settings

Concept of digital currency

云原生到底是什么?它会是未来发展的趋势吗?

谁拥有穿越周期的眼光?
随机推荐
Import and export of power platform platform sharepointlist
Wechat applet WebView prohibits page scrolling without affecting the implementation of overflow scrolling in the business
SSH服务器拒绝密码,再试一次;PermitRootLogin yes无效问题
PHP 字符串与二进制相互转换
How did the data center change from "Britney Spears" to "Mrs. cow"?
这样理解mmap,挺有意思!
SQL learning notes (03) -- data constraint relationship
好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!
sql语句修改字段类型「建议收藏」
Project procurement management
MapReduce programming basics
Error org apache. catalina. core. StandardContext. FilterStart start filter exception
主流实时流处理计算框架Flink初体验
Postgraduate entrance examination vocabulary 2023 sharing (1)
Swag init error: cannot find type definition: response Response
Win11账号被锁定无法登录怎么办?Win11账号被锁定无法登录
Introduction to expressions and operators in C language
一个悄然崛起的国产软件,低调又强大!
Solution of EPS image blur by latex insertion
集成积木报表报错 org.apache.catalina.core.StandardContext.filterStart 启动过滤器异常