当前位置:网站首页>sql中substr与substring函数用法
sql中substr与substring函数用法
2022-07-21 08:48:00 【共黄昏】
sql中substr与substring函数用法
他们的功能相似,都能截取字符串
语法介绍一:
SUBSTR(str,pos) 相当于 SUBSTR(str FROM pos)
SUBSTRING(str,pos)相当于SUBSTRING(str FROM pos)
参数介绍
str:欲截取的字符串
pos:开始位置即你想要从第几个字符开始截取
注意:
- 字符串的字符计数是从1开始的,不是0,如果pos值写为0,将会返回一个空
- 开始的位置可以为负数,为负数时是倒数的,最后一个字符是-1
- 返回的值是从 pos开始到最后 的子字符串
案例
substr:
substring:
语法介绍二:
SUBSTR(str,pos,len)相当于SUBSTR(str FROM pos FOR len)
SUBSTRING(str,pos,len)相当于SUBSTRING(str FROM pos FOR len)
参数介绍
str:欲截取的字符串
pos:开始位置即你想要从第几个字符开始截取( 注意的点和上同)
len:你想要截取出的字符长度(注意:如果这个len<1,那结果会返回空)
结果:返回从 pos开始 ,长度是len的子字符串
案例
substr
substring
边栏推荐
- This article enables you to master 22 neural network training skills
- 2022.7.20-----leetcode. one thousand two hundred and sixty
- Jupyterhub configuring go environment
- Apache Atlas 2.2版本安装
- 一文让你掌握22个神经网络训练技巧
- 父子进程、僵尸进程和孤儿进程
- Rust learning notes -rust language foundation
- How to implement an asynchronous network library with go?
- 将华为路由器做成ftp服务器(实现上传下载功能)
- 数字游戏:n人报数,报3的倍数的人离开,其余继续
猜你喜欢
NepCTF2022 WP
如何用Go实现一个异步网络库?
JVM memory layout detailed, illustrated, well written!
【论文阅读】Deep Video Anomaly Detection: Opportunities and Challenges
c#利用resx manager 切换中英文
CRM concept: understand the concepts of leads, prospect, MQL and SQL
2022-7-17 FTP客户端项目实现 - 总结
SpaceX has reached an agreement with Mattel, a Barbie doll manufacturer, on theme toy products
m在ISE平台下使用verilog开发基于FPGA的GMSK调制器
谷歌展示 Chrome 浏览器图标废案,曾打算做成小火箭
随机推荐
Reprint: can bus terminal resistance
玫瑰
Number game: n people count off, those who report a multiple of 3 leave, and the rest continue
Does this mean that MySQL's binlog has been turned on?
SQL164 2021年11月每天新用户的次日留存率
Aruba learning notes 03 Web UI -- Introduction to monitoring panel
神经网络加上注意力机制,精度不升反降?
Neural network plus attention mechanism, accuracy does not rise but fall?
微软将在安全软件和云业务部门放缓招聘
2022.7.20-----leetcode.1260
Idea running @test cannot be input from the console and is in the loading state
06-1. Friends, initialization list initialization, Nei 'Bu
QT大杂烩(总)
Go Gorm MySQL reports an error: error 1292: incorrect datetime value: 'xxx' for column 'created_ at‘ at row 1
Dynamic programming knapsack problem -- 01 knapsack
时间不一致
Framework API在线查看源码
「华流才是顶流」?分享你心目中的YYDS
JVM memory layout detailed, illustrated, well written!
05-1. Default member function: copy constructor, assignment operator overload