MySQL String Functions – Tutorialpath

MySQL String Functions

The most commonly used MySQL string functions that allow you to manipulate character string data effectively.

MySQL server is not specially designed to handle strings, there is a rich set of string functions available.

It is handy to use a string function inside your MySQL statement, do use it. If the string operation is too heavy for database server to handle, you’d better leave string manipulation for the client (such as PHP) to do.

 Functions  Description
 Concat  Concatenate two or more strings into one.
 CONVERT  Converting one data type to other
 character_length  Number of characters present in data
 char_length  Number of characters present in a string
 ELT  Return the string based on position
 TRIM  Removing matching string from both ends of a string
 substring_index  Part of the string using delimiter
 substring  Getting Part of the string
 strcmp  String Comparison
 SPACE  Adding Space
 RIGHT  Part of a string towards right
 Repeat  Repeating string n number of times
 Reverse  Reversing a string by Query
 replace  Search and replace a substring in a string.
 RTRIM  Remove blank space from Right
 LTRIM  Remove blank space from Left
 LPAD  Pad string from Left
 FIELD  Return the position of the searched string
 FIND_IN_SET  searching string within a set of strings
 locate  searching the string & getting location of presence
 Lower Upper case  Changing lower case to upper case and vies versa
 Length  Length of the string in bytes and in characters.
 BIT_LENGTH()  Returns length of argument in bits
 CONV()  Converts numbers between different number bases
 ASCII()  Returns numeric value of left-most character
 FORMAT()  Returns a number formatted to specified number of decimal places
 HEX()  Returns a string representation of a hex value

Leave a Reply

Your email address will not be published.