当前位置:网站首页>Important SQL server functions - string utilities
Important SQL server functions - string utilities
2022-07-28 04:24:00 【Navicat China】
The first 1 part : String Utility
Every programming language seems to have some functions . Even though SQL In many ways with typical process programming languages ( for example C# or Java) Somewhat different , But it also comes with impressive built-in functions . These can be applied to CHAR、VARCHAR and TEXT data type . Each database vendor's function implementation is not exactly the same , therefore , It is worthwhile to be familiar with the functions specific to the database you are using . In this series , We will learn from SQL Server Realize some important SQL function . Today's article will discuss string functions , And the following article will discuss numbers 、 Date functions and so on !
LEN
One of the most useful string functions is a function that calculates characters ( Including spaces and punctuation ) Quantity function that returns the length of the string . In Microsoft products , This function has been called “LEN”. This is the signature of the function :
LEN(inputString)
for example , We will use Navicat for SQL Server As our database client , Yes Sakila The sample database performs a real query . The query is from film Select the top in descending order in the table 10 The longest Title :

TRIM
Want to remove some useless characters from the string ? that TRIM Function is very suitable for you ! It eliminates redundant spaces and tabs at the beginning and end of the string we pass as parameters . This is a TRIM The signature of the :
TRIM(inputString)
By comparing the length of the cropped title with the current length , We can use TRIM To find out whether our movie title contains leading or trailing spaces :

CONCAT
In programming , The combination of strings is called concatenation . therefore ,CONCAT Function combines two or more strings that we pass in as parameters . This is its signature :
CONCAT(string1, string2, ...., string_n)
CONCAT Functions are very useful , Format multiple columns together in a way that suits you and your users . The following query combines the ID、 Title and year of issue , And use commas to separate them :

UPPER and LOWER
These two equivalent functions take a string parameter and return the same string , But all its characters are converted to uppercase and lowercase respectively .
UPPER(inputString)
To show UPPER and LOWER The effect of the function , We can display the movie title in original case , And change it through each function :

stay Navicat Using functions in
Navicat Of SQL One of the functions of the editor is to automatically complete the code . Once you start typing words , A series of suggestions will appear , It contains all database objects , Including patterns 、 surface 、 View 、 Column 、 The process , Of course, there are function names :

Select function ( Or stored procedure ) after , The input parameters are highlighted for input . If you have more than one parameter , Then each parameter can pass TAB Key focused , For quick access to :

summary
In the first part of this series “ Important SQL Server function ” in , We introduced several useful string utility functions , Include LEN、TRIM、CONCAT、UPPER and LOWER. The next time , We will introduce numerical functions . If you are right about Navicat for SQL Server Interested in , Free trial 14 God .
Looking back
Navicat Poisoned | The truth is coming !
Equipment paralysis caused by piracy
Navicat 16.1 by OceanBase Community Edition
Navicat Become a member of the database Innovation Laboratory of the Academy of communications
Navicat Academic partnership program - Free education application
Navicat Technology think tank - Practical exercises and answers to various hot questions
Free trial introduction | Navciat 16 Database management tools
边栏推荐
- idea启动项目mvn命令终端用不了法将“mvn”项识别为 cmdlet
- What technical capabilities should a qualified software testing engineer have?
- 重要的 SQL Server 函数 - 日期函数
- 【YOLOv5实战5】基于YOLOv5的交通标志识别系统-YOLOv5整合PyQt5
- Notes to subject 2
- pl/sql之各参数详解(“箱子模型“)
- 程序人生 | 测试工程师还只会点点点?7个捷径教给你快速学习新技术...
- Shell rental reptile
- setup和hold timing分析不满足是解决方法
- Cyber Nuwa, how to make digital people?
猜你喜欢

Un7.27: common commands of redis database.

21 days, fat brother personally takes you to play oauth2

重要的 SQL Server 函数 - 数字函数

pl/sql之各参数详解(“箱子模型“)

Machine learning 06: Decision Tree Learning

ftp服务器、nfs服务器的搭建和使用

There are so many ways to view the web source code! Do you know?

Thoroughly understand the sharing function in wechat games

校园流浪猫信息记录和分享的小程序源码

重要的 SQL Server 函数 - 其他函数
随机推荐
高数_第4章__曲线积分
H. 265 web player easyplayer realizes webrtc video real-time recording function
《关于我写自定义cell这件事》
un7.27:redis数据库常用命令。
Information system project manager (2022) - key content: Project Contract Management (13)
Solana's "deceptive behavior": making mobile phones and opening stores
UBI read only file system
[untitled]
glusterfs 文件未挂载,权限: r-s
About me writing a custom cell
Network visualization: features of convolution kernel and CNN visualization (through the attention part of gradient visualization network)
Filters, interceptors, listeners
[day03] process control statement
40: Chapter 4: Development File Service: 1:fastdfs: (1): introduction to fastdfs;
C语言初阶——循环语句(while,for,do while)
20-Openwrt crond crontab
Classification cluster analysis
C#跨线程刷新前台UI
JDBC usage
Machine learning 07: Bayesian learning