SUBSTR() function

MySQL SUBSTR() returns the specified number of characters from a particular position of a given string. SUBSTR() is a synonym for SUBSTRING().

Syntax:

SUBSTR(str, pos, len)

Arguments

Name
Description
str
A string from which a substring is to be returned.
pos
An integer indicating a string position within the string str.
len

An integer indicating a number of characters to be returned.

LEFT() function

MySQL LEFT() returns a specified number of characters from the left of the string. Both the number and the string are supplied as arguments of the function.

Syntax:

LEFT (string, length)

Arguments

Name
Description
string
The string from which a number of characters from the left are to be returned.
length
An integer which indicates the number of characters to be returned starting from the left of the string in the first argument.

RIGHT() function

MySQL RIGHT() extracts a specified number of characters from the right side of a string.

Syntax:

RIGHT(str, len)

Arguments

Name
Description
str
A string from whose right side a number of characters are to be extracted.
len
An integer indicating the number of characters to be extracted from str.

 

Continua leyendo «MySQL string functions»

Entradas relacionadas

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *