0% found this document useful (0 votes)
8 views9 pages

Essential SQL String Functions Guide

Uploaded by

tyagidipanshu13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views9 pages

Essential SQL String Functions Guide

Uploaded by

tyagidipanshu13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL String

Functions

Follow
Manni Chopra
Types of String Functions :
Common SQL String Functions
String functions are used to perform an
operation on input string and return an output
string. Following are the string functions
defined in SQL:
1. CONCAT(): Concatenate Strings
:

The CONCAT() function is used


to concatenate (combine) two or more strings into
one string. It is useful when we want to merge fields
like first and last names into a full name.

Syntax :
2. UPPER() : Convert Text Case
This functions convert the text to
uppercase respectively. They are useful
for normalizing the case of text in a
database.
Syntax :

3. Lower() : Convert Text Case


Syntax :
4. Length() : Length of String in Bytes
LENGTH() returns the length of a string
in bytes. This can be useful for working
with multi-byte character sets.

Syntax :

5. Replace() : Replace Substring in String

Syntax :
6. SUBSTRING(): Extract Part of a String
The SUBSTRING() function is used
to extract a substring from a string,
starting from a specified position. It is
especially useful when we need to
extract a specific part of a string, like
extracting the domain from an email
address :
Syntax

Result:
7. LEFT() and RIGHT():Extract Substring
from Left or Right
The LEFT() and RIGHT() functions
allow you to extract a specified number
of characters from the left or right side
of a string, respectively. It is used for
truncating strings for display.
Syntax LEFT() :

Syntax RIGHT():
9. TRIM(): Remove Leading and Trailing
Spaces
The TRIM() function
removes leading and trailing spaces (or
other specified characters) from a
string. By default, it trims spaces but
can also remove specific characters
using TRIM(character FROM string).
This is helpful for cleaning text data,
such as user inputs or database
records.
Syntax :
10. CONCAT_WS() :
This function is used to add two
words
or strings with a symbol as
concatenating symbol.
Syntax :

You might also like