当前位置:网站首页>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:defghde
2.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( )
边栏推荐
猜你喜欢
image里的mode属性
Optimization of aggregate mentioned at DATA AI Summit 2022
JS中? ?和??=和?.和 ||的区别
transition transition && animation animation
Steven Giesel 最近发布了一个由5部分内容组成的系列,记录了他首次使用 Uno Platform 构建应用程序的经验。
flex-direction容器属性
How to ensure the consistency of database and cache data?
asser利用蚁剑登录
Shell script if statement
Machine Learning 1-Regression Model (2)
随机推荐
天空云变化案例
Installation considerations for pytorch
数据库的严格模式
The difference between ?? and ??= and ?. and || in JS
jira是什么
what is jira
Axure Carousel
firewalld
Axure轮播图
The first level must project independently
(五)fastai应用
asser利用蚁剑登录
Mysql体系化之JOIN运算实例分析
借助深度估计的点云场景重建
Homework: iptables prevent nmap scan and binlog
uniapp develops WeChat applet - soft exam brushing applet
Shell编程条件语句 test命令 整数值,字符串比较 逻辑测试 文件测试
乌克兰外交部:乌已完成恢复粮食安全出口的必要准备
In MySQL, the stored procedure cannot realize the problem of migrating and copying the data in the table
如何在WordPress网站上添加导航菜单