当前位置:网站首页>The difference between substring and substr in MySQL
The difference between substring and substr in MySQL
2022-07-31 00:15:00 【Miracle_ze】
The difference between substring and substr
The difference between substring and substr
substring
1. Introduction
substring() is based on SQL Server and is used to intercept strings
2. Use
substring(start,stop)The two parameters are the start and end positions, including "start", excluding "stop", which is [start, stop).That is, the second parameter [stop] is the final subscript of the intercepted string
substr
1. Introduction
substr() is Oracle based
2. Use
substr(start,length)The first parameter is the starting position, and the second parameter is the length of the intercepted string
The similarities and differences between substring and substr
Similarities
1. Both are functions used to intercept strings.
2. If only one parameter is written, the functions of both are the same: that is to intercept the current subscript of the string until the last string of the stringFragment
var a=”abcdefghiklmnopqrstuvwxyz”;var b=a.substr(5);var c=a.substring(5);console.log(b);console.log(c);The result of this output is the same, which are all
fghiklmnopqrstuvwxyz intercepted from the fifth subscript 4 to the end
Different
1. The second parameter of the two has completely different meanings;
substr(a,b)
The second parameter is the length of the intercepted string
substring(a,b)
The second parameter is the final subscript of the intercepted string
var a="abcdefghiklmnopqrstuvwxyz";var b=a.substr(3,5);var c=a.substring(3,5);The result of the printout is:defghde2.substr() is based on Oracle, substring() is based on SQL Server, both substr() and substring() can be applied to MySQL
MySQL: SUBSTR( ), SUBSTRING( )Oracle: SUBSTR( )SQL Server: SUBSTRING( )边栏推荐
猜你喜欢
Dry goods | 4 tips for MySQL performance optimization

H5跳转微信公众号解决方案

DATA AI Summit 2022提及到的对 aggregate 的优化
![[In-depth and easy-to-follow FPGA learning 15---------- Timing analysis basics]](/img/a9/4c7a703a36a244394b586bfb42ab6b.png)
[In-depth and easy-to-follow FPGA learning 15---------- Timing analysis basics]

encrypted transmission process

SWM32系列教程6-Systick和PWM

joiplay模拟器不支持此游戏类型怎么解决

一款好用的接口测试工具——Postman

How to solve the error of joiplay simulator

How to import game archives in joiplay emulator
随机推荐
uni-ui installation
网络常用的状态码
如何在WordPress网站上添加导航菜单
牛逼的公司都在用的绩效管理法OKR
In MySQL, the stored procedure cannot realize the problem of migrating and copying the data in the table
Shell脚本 if语句
数据清洗-使用es的ingest
加密传输过程
Android安全性优化——APP加固
[动态规划] 0-1背包问题和完全背包问题
How to adjust Chinese in joiplay simulator
MySQL面试题
从两个易错的笔试题深入理解自增运算符
Bugku sql注入
状态机动态规划之股票问题总结
2D转换模块&&媒体查询
Oracle一个诡异的临时表空间不足的问题
宽客必备神器-AKShare
限制字符绕过
Point Cloud Scene Reconstruction with Depth Estimation