String Functions

NameDescription
ASCII()Return numeric value of left-most character
CHAR()Return the character for each integer passed
BIN()Return a string containing binary representation of a number
HEX()Return a hexadecimal representation of a decimal or string value
OCT()Return a string containing octal representation of a number
UNHEX()Return a string containing hex representation of a number
TO_BASE64()Return the argument converted to a base-64 string
FROM_BASE64()Decode to a base-64 string and return result
LOWER()Return the argument in lowercase
LCASE()Synonym for LOWER()
UPPER()Convert to uppercase
UCASE()Synonym for UPPER()
LPAD()Return the string argument, left-padded with the specified string
RPAD()Append string the specified number of times
TRIM()Remove leading and trailing spaces
LTRIM()Remove leading spaces
RTRIM()Remove trailing spaces
BIT_LENGTH()Return length of argument in bits
CHAR_LENGTH()Return number of characters in argument
CHARACTER_LENGTH()Synonym for CHAR_LENGTH()
LENGTH()Return the length of a string in bytes
OCTET_LENGTH()Synonym for LENGTH()
INSERT()Insert a substring at the specified position up to the specified number of characters
REPLACE()Replace occurrences of a specified string
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
MID()Return a substring starting from the specified position
LEFT()Return the leftmost number of characters as specified
RIGHT()Return the specified rightmost number of characters
INSTR()Return the index of the first occurrence of substring
LOCATE()Return the position of the first occurrence of substring
POSITION()Synonym for LOCATE()
REPEAT()Repeat a string the specified number of times
CONCAT()Return concatenated string
CONCAT_WS()Return concatenate with separator
REVERSE()Reverse the characters in a string
SPACE()Return a string of the specified number of spaces
FIELD()Return the index (position) of the first argument in the subsequent arguments
ELT()Return string at index number
EXPORT_SET()Return a string such that for every bit set in the value bits, you get an on string and for every unset bit, you get an off string
MAKE_SET()Return a set of comma-separated strings that have the corresponding bit in bits set
FIND_IN_SET()Return the index position of the first argument within the second argument
FORMAT()Return a number formatted to specified number of decimal places
ORD()Return character code for leftmost character of the argument
QUOTE()Escape the argument for use in an SQL statement

String comparison functions

NameDescription
LIKESimple pattern matching
NOT LIKENegation of simple pattern matching
STRCMP()Compare two strings

Regular expressions

NameDescription
REGEXPPattern matching using regular expressions
RLIKESynonym for REGEXP
NOT REGEXPNegation of REGEXP