当前位置:网站首页>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
边栏推荐
- H. 265 web player easyplayer realizes webrtc video real-time recording function
- 上班摸鱼打卡模拟器微信小程序源码
- servlet使用
- JDBC usage
- Cyber Nuwa, how to make digital people?
- There are so many ways to view the web source code! Do you know?
- 空间复杂度计算超全整理!!(一起手撕复杂度计算
- 高数_第4章__曲线积分
- 功耗:Leakage Power
- Un7.27: how to successfully build a ruoyi framework project in idea?
猜你喜欢

高数_第4章__曲线积分

将数据库拿到的数据渲染到elementUI 中的table中去

【无标题】

C语言初阶——循环语句(while,for,do while)

40: Chapter 4: Development File Service: 1:fastdfs: (1): introduction to fastdfs;

null安全与异常

Information system project manager (2022) - key content: Project Risk Management (11)

【实战】使用 Web Animations API 实现一个精确计时的时钟

idea2022更改本地仓库,配置阿里云中央仓库

Practice and thinking of AI standardization engine in pink client
随机推荐
un7.27:如何在idea中成功搭建若依框架项目?
About me writing a custom cell
【实战】使用 Web Animations API 实现一个精确计时的时钟
Information system project manager (2022) - key content: Project Portfolio Management (19)
MATLB | location and constant volume IEEE30 node implementation of distributed energy
关系数据库事务中的对象锁定
Do Netease and Baidu have their own tricks for seizing the beach AI learning machine?
un7.27:redis数据库常用命令。
离职前一定要做好这7件事情,少一件都很麻烦。
Information system project manager (2022) - key content: information system integrated testing and management, project management maturity model, quantitative project management (21)
21 openwrt kernel module changed to.Ko automatic loading
XML file usage and parsing
servlet使用
A little advice for students - how to build their own knowledge system?
Some personal understandings of openpose
Experience sharing of automatic test for students with monthly salary of 28K
Kotlin -- function
Docking with Hang Seng express ― dolphin DB NSQ plug-in tutorial
[record of question brushing] 9. Number of palindromes
Cyber Nuwa, how to make digital people?