MySQL – String Functions
Some most important String Functions are defined below:
Function |
Description |
---|---|
CONCAT_WS() |
It Concatenates strings with a specified separator. |
CONCAT() |
It Concatenates two or more strings. |
CHARACTER_LENGTH() |
It Returns the number of characters in a string. |
ELT() |
It Returns the string at the specified index from a list of strings. |
EXPORT_SET() |
It Returns a string where each bit of a bitmap value corresponds to a value in a set. |
FIELD() |
It Returns the index (position) of a string in a list of strings. |
FIND_IN_SET() |
It Returns the position of a string within a comma-separated list of strings. |
FORMAT() |
It Formats a number to a format like ‘#,###,###.##’, rounded to a specified number of decimal places. |
FROM_BASE64() |
It Decodes a base64-encoded string. |
HEX() |
It Returns a string representation of a hexadecimal value. |
INSERT() |
It Inserts a substring into a string at a specified position and for a certain number of characters |
INSTR() |
It Returns the position of the first occurrence of a substring in a string. |
LENGTH() |
The LENGTH() function returns the length of a string in bytes. |
REPLACE() |
The REPLACE() function replaces all occurrences of a substring within a string with another substring |
QUOTE() |
It Returns a string enclosed in single quotes, with special characters escaped. |
REVERSE() |
It Reverses a string. |
REPEAT() |
It Repeats a string a specified number of times. |
RIGHT() |
It Returns the rightmost characters of a string. |
MySQL – String Functions
MySQL is one of the most widespread relational database management systems that covers many functions to manipulate the strings precisely. Processing text data in MySQL can go from a simple concatenation to pattern matching/substring extraction. In this article, we will be considering some commonly used MySQL string functions and their syntax, usage as well as examples.