当前位置:网站首页>Character interception triplets of data warehouse: substrb, substr, substring
Character interception triplets of data warehouse: substrb, substr, substring
2022-06-27 20:36:00 【InfoQ】
summary
Function form :
substrb(string, from [, count])
substr(string, from [, count])
substring(string, from [, count])
Parameters to describe :
From parameter string Extract substring from ,from Indicates the starting position of the extraction ,count Represents the length of the extracted substring .
return type :
text
differences
1. Interception unit

postgres=# select substrb('hwgs HUAWEI ',3,5),substr('hwgs HUAWEI ',3,5),substring('hwgs HUAWEI ',3,5);
substrb | substr | substring
---------+----------+-----------
gs Hua | gs Huawei | gs Huawei
(1 row)
2. Interception rules

postgres=# select substrb('hwgs HUAWEI ',5,3),substrb('hwgs HUAWEI ',8,3);
substrb | substrb
---------+---------
Hua | by
(1 row)
postgres=# select substrb('hwgs HUAWEI ',-6,3),substrb('hwgs HUAWEI ',-3,3);
substrb | substrb
---------+---------
Male | department
(1 row)
postgres=# select substrb('hwgs HUAWEI ',5,0),substrb('hwgs HUAWEI ',8,-1);
substrb | substrb
---------+---------
|
(1 row)

postgres=# select substr('hwgs HUAWEI ',5,3),substr('hwgs HUAWEI ',8,3);
substr | substr
--------+--------
Huawei | department
(1 row)
postgres=# select substr('hwgs HUAWEI ',0,3),substr('hwgs HUAWEI ',0,3);
substr | substr
--------+--------
hwg | hwg
(1 row)
mysql_db=# select substr('hwgs HUAWEI ',0,3),substr('hwgs HUAWEI ',0,3);
substr | substr
--------+--------
|
(1 row)

postgres=# select substring('hwgs HUAWEI ',0,3),substring('hwgs HUAWEI ',-1,3);
substring | substring
-----------+-----------
hw | h
(1 row)
td_db=# select substring('hwgs HUAWEI ',0,3),substring('hwgs HUAWEI ',-1,3);
substring | substring
-----------+-----------
hw | h
(1 row)
mysql_db=# select substring('hwgs HUAWEI ',0,3),substring('hwgs HUAWEI ',-1,3);
substring | substring
-----------+-----------
| department
(1 row)
td_db=# select substring('hwgs HUAWEI ',0,-1);
ERROR: negative substring length not allowed
CONTEXT: referenced column: substring
mysql_db=# select substring('hwgs HUAWEI ',0,-1);
substring
-----------
(1 row)
Summary
边栏推荐
- pfSense Plus22.01中文定制版发布
- Redis持久化
- Univision hyperinsight: Nuggets' $16.494 billion "gold hoe" in the observable market?
- Postman Chinese tutorial (postman Chinese version)
- Observable, reliable: the first shot of cloudops series Salon of cloud automation operation and maintenance
- 安装NFS服务
- ABAP essays - interview memories hope that everyone's demand will not increase and the number of people will soar
- Longitude and latitude analysis
- 数仓的字符截取三胞胎:substrb、substr、substring
- 蓄力中台,用友iuap筑牢社会级企业数智化新底座
猜你喜欢
Redis持久化
数智化进入“深水区”,数据治理是关键
muduo
Practice of combining rook CEPH and rainbow, a cloud native storage solution
[login interface]
Oracle architecture summary
Installation and configuration of grayog new generation log collection early warning system
键入网址到网页显示,期间发生了什么?
Accumulating power in the middle stage, UFIDA IUAP builds a new base for digital intelligence of social enterprises
redis数据结构
随机推荐
I haven't thought about the source for some time. After upgrading to the latest version 24, the data encryption problem is repeatedly displayed
Connection integration development theme month | drivers of enterprise master data governance
SQL报了一个不常见的错误,让新来的实习生懵了
花了6个月时间完成本科优秀毕业设计,我做了什么?
eval函数,全局、本地变量
数仓的字符截取三胞胎:substrb、substr、substring
可观测,才可靠:云上自动化运维CloudOps系列沙龙 第一弹
从指令交读掌握函数调用堆栈详细过程
UOS提示输入密码以解锁您的登陆密钥环解决办法
SQL reported an unusual error, which confused the new interns
Database index
连接集成开发专题月 | 企业主数据治理的驱动因素
散列表(Hash)-复习
数据库引擎
[help] troubleshooting of JVM's high CPU resource consumption
Database lock problem
muduo
Database optimization
SQL Server - window function - solve the problem of filtering consecutive n records
[数组]BM99 顺时针旋转矩阵-简单