当前位置:网站首页>String function in MySQL
String function in MySQL
2022-04-23 17:56:00 【Jian Xiaolin】
1. About the length of the string
Code example :
select ascii('abc') ,char_length(' database '),length (' database ')
from dual;
ascii(s): Take the... Corresponding to the first place of the string ascii code
char_length(s): String length
length(s): Number of bytes of string
Running results :
2. String connection
Code example :
select concat(e.lie1,'worked for',m.lie1)
from table e join table m
where e.lie3 =m.lie1 ;
concat : Connection of columns and strings , The specified string can be connected in the middle , As in the example above worked for.
3. String insertion and replacement
Code example :
select insert ('hello',2,3,'ddd'),replace ('hello','ll','oo')
from dual;
insert(a,b,c,d) In string a Of b Starting from , take b Go to b+c Replace with d.
replace(a,b,c) In the string b Replacing the c.
select left ('mysql',3)
from dual ;
left(a,b) Take the string a From left to front b A digital ,right Empathy .
Running results :
4. Clean and double
Code example :
select trim(' my sql ') ,trim('my' from 'mysql')
from dual;
select repeat ('mysql',2)
from dual ;
trim(a) Clear string a Spaces at both ends .
trim(a from b) eliminate b The... Contained in the string a character string .
repeat(a,b) The string a to b times .
Running results :
5. Find the position of the string
Code example :
select elt(3,'a','b','c') ,field('my','sq','mysql','my'),find_in_set('my','m,my,mysql')
from dual ;
select reverse('abc')
from dual ;
elt(n,a,b,c...) from a Start looking for the second n Characters , Output this character .
field(n,a,b,c...) from a Start looking for n, Output the number of its location .
reverse(s) Reverse output .
Running results :
版权声明
本文为[Jian Xiaolin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231753567912.html
边栏推荐
- 394. String decoding - auxiliary stack
- Ring back to origin problem - byte jumping high frequency problem
- 41. 缺失的第一个正数
- Implementation of object detection case based on SSD
- ros常用的函数——ros::ok(),ros::Rate,ros::spin()和ros::spinOnce()
- Examination question bank and online simulation examination of the third batch (main person in charge) of special operation certificate of safety officer a certificate in Guangdong Province in 2022
- Applet learning notes (I)
- How to read literature
- Thirteen documents in software engineering
- Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
猜你喜欢
Open source key component multi_ Button use, including test engineering
394. 字符串解码-辅助栈
Logic regression principle and code implementation
Gets the time range of the current week
Cross domain settings of Chrome browser -- including new and old versions
MySQL 中的字符串函数
JS parsing and execution process
Summary of floating point double precision, single precision and half precision knowledge
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
极致体验,揭晓抖音背后的音视频技术
随机推荐
Leak detection and vacancy filling (VII)
587. 安装栅栏 / 剑指 Offer II 014. 字符串中的变位词
MySQL_01_简单数据检索
2022年流动式起重机司机国家题库模拟考试平台操作
土地覆盖/利用数据产品下载
列表的使用-增删改查
undefined reference to `Nabo::NearestNeighbourSearch
cartographer_ There is no problem compiling node, but running the bug that hangs directly
2022年上海市安全员C证操作证考试题库及模拟考试
394. String decoding - auxiliary stack
Timestamp to formatted date
Go对文件操作
Gaode map search, drag and drop query address
Encapsulate a timestamp to date method on string prototype
云原生虚拟化:基于 Kubevirt 构建边缘计算实例
JS parsing and execution process
列錶的使用-增删改查
SystemVerilog (VI) - variable
2022年茶艺师(初级)考试模拟100题及模拟考试
Add animation to the picture under V-for timing