MySQL offers many built-in string functions. MySQL string function can be categorize as String Comparison Functions, Regular Expressions and Character Set and Collation of Function.
Function | Description |
---|---|
ASCII() | Return numeric value of left-most character |
BIN() | Return a string that contains binary data of a number |
BIT_LENGTH() | Return length of argument in bits |
CHAR_LENGTH() | Return number of characters in given string |
CHARACTER_LENGTH() | Synonym for CHAR_LENGTH() |
CONCAT() | Return combined string |
CONCAT_WS() | Return combined string with separator |
ELT() | Return string at index number |
EXPORT_SET() | Return a string such that for every bit set in the value bits |
FIELD() | Return the position of the first argument in the subsequent arguments |
FIND_IN_SET() | Return the index position of the first argument within the second argument |
FORMAT() | Formats the number like '#,###,###.##' and rounded with decimal places, and returns the result as a string. |
FROM_BASE64() | Returns the decoded result as a binary string |
HEX() | Return a hexadecimal representation of a string value |
INSERT() | Insert a substring at the specified position up to the specified number of characters |
INSTR() | Return the position of the first occurrence of substring |
LCASE() | Synonym for LOWER() |
LEFT() | Return the leftmost number of specified characters from string |
LENGTH() | Return the length of a string |
LIKE | Simple pattern matching |
LOAD_FILE() | Reads the file and returns the file contents as a string |
LOCATE() | Return the position of the first occurrence of substring |
LOWER() | Return the string in lowercase |
LPAD() | Return the string, left-padded with the specified string |
LTRIM() | Remove left spaces from string |
MAKE_SET() | Return a set of comma-separated strings |
MATCH | Perform full-text search |
MID() | Return a substring from specified position |
NOT LIKE | Negation of simple pattern matching |
NOT REGEXP | Negation of REGEXP |
OCT() | Return a string containing octal representation of a number |
OCTET_LENGTH() | Synonym for LENGTH() |
ORD() | Return character code for leftmost character of the argument |
POSITION() | Synonym for LOCATE() |
QUOTE() | Escape the argument for use in an SQL statement |
REGEXP | Synonym for REGEXP_LIKE() |
REPEAT() | Repeat a string the specified number of times |
REPLACE() | Replace occurrences of a specified string |
REVERSE() | Reverse the characters in a string |
RIGHT() | Return the specified rightmost number of characters |
RLIKE | Synonym for REGEXP_LIKE() |
RPAD() | Append string the specified number of times |
RTRIM() | Remove trailing spaces |
SOUNDEX() | Return a soundex string |
SOUNDS LIKE | Compare sounds |
SPACE() | Return a string of the specified number of spaces |
STRCMP() | Compare two strings |
SUBSTR() | Return the substring as specified |
SUBSTRING() | Return the substring as specified |
SUBSTRING_INDEX() | Return a substring from a string before the specified number of occurrences of the delimiter |
TO_BASE64() | Return the string converted to a base-64 string |
TRIM() | Remove left and right spaces |
UCASE() | Synonym for UPPER() |
UNHEX() | Return a string containing hex representation of a number |
UPPER() | Convert to uppercase |
WEIGHT_STRING() | Return the weight string for a string |