MySQL String Functions
This page lists the string functions in MySQL that help you to manipulate strings efficiently.
-
ASCII
The MySQLASCII()
function returns the corresponding ASCII value of the specified character. -
BIN
The MySQLBIN()
function return a string representation of the binary value of a given number. -
BIT_LENGTH
The MySQLBIT_LENGTH()
function return the length of a given string in bits. -
CHAR
The MySQLCHAR()
function converts each integer parameter to an character, and returns these characters as a string. -
CHAR_LENGTH
The MySQLCHAR_LENGTH()
function returns the length of the given string. -
CHARACTER_LENGTH
The MySQLCHARACTER_LENGTH()
function returns the length of the given string. -
CONCAT
The MySQLCONCAT()
function is used to join two or more specified strings. -
CONCAT_WS
The MySQLCONCAT_WS()
function is used to join two or more specified strings with the specified delimiter. -
ELT
The MySQLELT()
function returns string parameters at the specified position from all parameters. -
EXPORT_SET
The MySQLEXPORT_SET()
function generates a string using the specified delimiter based on the bits of the argument. -
FIELD
The MySQLFIELD()
function return the index of a specified value in a given list. -
FIND_IN_SET
The MySQLFIND_IN_SET()
function return the position of a specified value in a comma-separated string list. -
FORMAT
The MySQLFORMAT()
function return a number formatted to specified number of decimal places. -
FROM_BASE64
The MySQLFROM_BASE64()
function decodes thebase-64
encoded data and returns the result as a binary string. -
HEX
The MySQLHEX()
function returns a string that represents the hexadecimal value of the given number or string. -
INSERT
The MySQLINSERT()
replace the substring specified by start position and lenth with a new string. -
INSTR
The MySQLINSTR()
function returns the position of the first occurrence of a substring in a string. -
LCASE
The MySQLLCASE()
function converts the specified string to lowercase and returns it. -
LEFT
The MySQLLEFT()
function returns the leftmostN
characters of a string. -
LENGTH
The MySQLLENGTH()
unction returns the length of the specified string in bytes. -
LOCATE
The MySQLLOCATE()
function returns the index of the first occurrence of a substring in a string. -
LOWER
The MySQLLOWER()
function converts the specified string to lowercase and returns it. -
LPAD
The MySQLLPAD()
function left pads a string with a string to the specified length. -
LTRIM
The MySQLLTRIM()
function removes leading spaces from the specified string. -
MAKE_SET
The MySQLMAKE_SET()
function returns a set of comma-separated strings that have the corresponding bit in bits set. -
MID
The MySQLMID()
function returns a substring of a specified length starting from the specified position. -
OCT
The MySQLOCT()
function return a string representation of the octal value of a given number. -
OCTET_LENGTH
The MySQLOCTET_LENGTH()
unction returns the length of the specified string in bytes. -
ORD
The MySQLORD()
function returns the character code of the first character in a string. -
POSITION
The MySQLPOSITION()
function returns the index of the first occurrence of a substring in a string. -
QUOTE
The MySQLQUOTE()
function returns a string enclosed in single quotes. -
REPEAT
The MySQLREPEAT()
function repeats the specified string the specified number of times. -
REPLACE
The MySQLREPLACE()
function replaces all occurrences of a string within another string. -
REVERSE
The MySQLREVERSE()
unction reverses the characters in a string and returns a string with the order of the characters reversed. -
RIGHT
The MySQLRIGHT()
function returns the rightmostN
characters of a string. -
RPAD
The MySQLRPAD()
function right pads a string with a string to the specified length. -
RTRIM
The MySQLRTRIM()
function removes trailing spaces from the specified string. -
SOUNDEX
The MySQLSOUNDEX()
function returns a soundex string representing the pronunciation of the string. -
SPACE
The MySQLSPACE()
function returns a string consisting of a specified number of space characters. -
STRCMP
The MySQLSTRCMP()
function compares two strings and returns the result of the comparison. -
SUBSTR
The MySQLSUBSTR()
function returns a substring of a specified string starting starting at a specified position. -
SUBSTRING
The MySQLSUBSTRING()
function returns a substring of a specified string starting starting at a specified position. -
SUBSTRING_INDEX
The MySQLSUBSTRING_INDEX()
function returns the substring from a specified string before specified number of occurrences of a specified delimiter. -
TO_BASE64
The MySQLTO_BASE64()
function converts the string argument to base-64 encoded form and returns the string representation. -
TRIM
The MySQLTRIM()
function returns a string with the specified leading and/or trailing characters removed. -
UCASE
The MySQLUCASE()
function converts the specified string to uppercase and returns it. -
UNHEX
The MySQLUNHEX()
function converts a string representing a hexadecimal value to bytes and returns the corresponding binary string. -
UPPER
The MySQLUPPER()
function converts the specified string to uppercase and returns it.