MySQL String Functions

This page lists the string functions in MySQL that help you to manipulate strings efficiently.

  1. ASCII

    The MySQL ASCII() function returns the corresponding ASCII value of the specified character.
  2. BIN

    The MySQL BIN() function return a string representation of the binary value of a given number.
  3. BIT_LENGTH

    The MySQL BIT_LENGTH() function return the length of a given string in bits.
  4. CHAR

    The MySQL CHAR() function converts each integer parameter to an character, and returns these characters as a string.
  5. CHAR_LENGTH

    The MySQL CHAR_LENGTH() function returns the length of the given string.
  6. CHARACTER_LENGTH

    The MySQL CHARACTER_LENGTH() function returns the length of the given string.
  7. CONCAT

    The MySQL CONCAT() function is used to join two or more specified strings.
  8. CONCAT_WS

    The MySQL CONCAT_WS() function is used to join two or more specified strings with the specified delimiter.
  9. ELT

    The MySQL ELT() function returns string parameters at the specified position from all parameters.
  10. EXPORT_SET

    The MySQL EXPORT_SET() function generates a string using the specified delimiter based on the bits of the argument.
  11. FIELD

    The MySQL FIELD() function return the index of a specified value in a given list.
  12. FIND_IN_SET

    The MySQL FIND_IN_SET() function return the position of a specified value in a comma-separated string list.
  13. FORMAT

    The MySQL FORMAT() function return a number formatted to specified number of decimal places.
  14. FROM_BASE64

    The MySQL FROM_BASE64() function decodes the base-64 encoded data and returns the result as a binary string.
  15. HEX

    The MySQL HEX() function returns a string that represents the hexadecimal value of the given number or string.
  16. INSERT

    The MySQL INSERT() replace the substring specified by start position and lenth with a new string.
  17. INSTR

    The MySQL INSTR() function returns the position of the first occurrence of a substring in a string.
  18. LCASE

    The MySQL LCASE() function converts the specified string to lowercase and returns it.
  19. LEFT

    The MySQL LEFT() function returns the leftmost N characters of a string.
  20. LENGTH

    The MySQL LENGTH() unction returns the length of the specified string in bytes.
  21. LOCATE

    The MySQL LOCATE() function returns the index of the first occurrence of a substring in a string.
  22. LOWER

    The MySQL LOWER() function converts the specified string to lowercase and returns it.
  23. LPAD

    The MySQL LPAD() function left pads a string with a string to the specified length.
  24. LTRIM

    The MySQL LTRIM() function removes leading spaces from the specified string.
  25. MAKE_SET

    The MySQL MAKE_SET() function returns a set of comma-separated strings that have the corresponding bit in bits set.
  26. MID

    The MySQL MID() function returns a substring of a specified length starting from the specified position.
  27. OCT

    The MySQL OCT() function return a string representation of the octal value of a given number.
  28. OCTET_LENGTH

    The MySQL OCTET_LENGTH() unction returns the length of the specified string in bytes.
  29. ORD

    The MySQL ORD() function returns the character code of the first character in a string.
  30. POSITION

    The MySQL POSITION() function returns the index of the first occurrence of a substring in a string.
  31. QUOTE

    The MySQL QUOTE() function returns a string enclosed in single quotes.
  32. REPEAT

    The MySQL REPEAT() function repeats the specified string the specified number of times.
  33. REPLACE

    The MySQL REPLACE() function replaces all occurrences of a string within another string.
  34. REVERSE

    The MySQL REVERSE() unction reverses the characters in a string and returns a string with the order of the characters reversed.
  35. RIGHT

    The MySQL RIGHT() function returns the rightmost N characters of a string.
  36. RPAD

    The MySQL RPAD() function right pads a string with a string to the specified length.
  37. RTRIM

    The MySQL RTRIM() function removes trailing spaces from the specified string.
  38. SOUNDEX

    The MySQL SOUNDEX() function returns a soundex string representing the pronunciation of the string.
  39. SPACE

    The MySQL SPACE() function returns a string consisting of a specified number of space characters.
  40. STRCMP

    The MySQL STRCMP() function compares two strings and returns the result of the comparison.
  41. SUBSTR

    The MySQL SUBSTR() function returns a substring of a specified string starting starting at a specified position.
  42. SUBSTRING

    The MySQL SUBSTRING() function returns a substring of a specified string starting starting at a specified position.
  43. SUBSTRING_INDEX

    The MySQL SUBSTRING_INDEX() function returns the substring from a specified string before specified number of occurrences of a specified delimiter.
  44. TO_BASE64

    The MySQL TO_BASE64() function converts the string argument to base-64 encoded form and returns the string representation.
  45. TRIM

    The MySQL TRIM() function returns a string with the specified leading and/or trailing characters removed.
  46. UCASE

    The MySQL UCASE() function converts the specified string to uppercase and returns it.
  47. UNHEX

    The MySQL UNHEX() function converts a string representing a hexadecimal value to bytes and returns the corresponding binary string.
  48. UPPER

    The MySQL UPPER() function converts the specified string to uppercase and returns it.