当前位置:网站首页>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
边栏推荐
- 122. The best time to buy and sell stocks II - one-time traversal
- cv_ Solution of mismatch between bridge and opencv
- 470. Rand10() is implemented with rand7()
- Some questions some questions some questions some questions
- 958. 二叉树的完全性检验
- Detailed deployment of flask project
- C# 的数据流加密与解密
- MySQL进阶学习之SQL优化【插入,主键,排序,分组,分页,计数】
- ES6 new method
- 41. The first missing positive number
猜你喜欢

2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination

Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)

The ultimate experience, the audio and video technology behind the tiktok

Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战

Classification of cifar100 data set based on convolutional neural network

Cross domain settings of Chrome browser -- including new and old versions

Kubernetes service discovery monitoring endpoints
![Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag](/img/ed/4d61ce34f830209f5adbddf9165676.png)
Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag

MySQL_01_简单数据检索

2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition
随机推荐
2022年茶艺师(初级)考试模拟100题及模拟考试
Go file operation
198. Looting - Dynamic Planning
C# 网络相关操作
Comparison between xtask and kotlin coroutine
Use of list - addition, deletion, modification and query
Operation of 2022 mobile crane driver national question bank simulation examination platform
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
122. 买卖股票的最佳时机 II-一次遍历
Halo 开源项目学习(二):实体类与数据表
92. Reverse linked list II byte skipping high frequency question
k8s之实现redis一主多从动态扩缩容
Kubernetes 服务发现 监控Endpoints
Future usage details
JS parsing and execution process
48. Rotate image
Error in created hook: "referenceerror:" promise "undefined“
587. Install fence / Sword finger offer II 014 Anagrams in strings
Listen for click events other than an element
Halo open source project learning (II): entity classes and data tables