MySQL - String Functions



MySQL - String Functions

MySQL string functions are used to manipulate the string values. The following table details the string functions that are available in the MySQL.

Sr.No. Name & Description
1 ASCII()

This function returns numeric value of left-most character.

2 BIN()

This function returns a string representation of the argument.

3 BIT_LENGTH()

This function returns length of argument in bits.

4 CHAR()

This function returns the character for each integer passed.

5 CHAR_LENGTH()

This function returns number of characters in argument.

6 CHARACTER_LENGTH()

This function is a synonym for CHAR_LENGTH().

7 CONCAT()

This function returns concatenated string.

8 CONCAT_WS()

This function returns concatenate with separator.

9 ELT()

This function returns string at index number.

10 EXPORT_SET()

This function returns 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.

11 FIELD()

This function returns the index (position) of the first argument in the subsequent arguments.

12 FIND_IN_SET()

This function returns the index position of the first argument within the second argument.

13 FROM_BASE64()

This function decodes a base-64 encoded string as a binary string.

14 INSERT()

Inserts a substring at the specified position up to the specified number of characters.

15 INSTR()

This function returns the index of the first occurrence of substring.

16 LCASE()

Synonym for LOWER().

17 LEFT()

This function returns the leftmost number of characters as specified.

18 LENGTH()

This function returns the length of a string in bytes.

19 LOAD_FILE()

This function is used to load the specified file.

20 LOCATE()

This function returns the position of the first occurrence of substring.

21 LOWER()

This function returns the argument in lowercase.

22 LPAD()

This function returns the string argument, left-padded with the specified string.

23 LTRIM()

This function is used to removes leading spaces from the given string.

24 MAKE_SET()

This function returns a set of comma-separated strings that have the corresponding bit in bits set.

25 MID()

This function returns a substring starting from the specified position.

26 OCT()

This function returns a string representation of the octal argument.

27 OCTET_LENGTH()

This function is a synonym for LENGTH().

28 ORD()

If the leftmost character of the argument is a multi-byte character, returns the code for that character.

29 POSITION()

This function is a synonym for LOCATE().

30 QUOTE()

This function escapes the argument for use in an SQL statement.

31 REPEAT()

This function returns the starting index of the substring matching given regular expression.

32 REPLACE()

This function replaces the matched sub string with the replacement string and returns the result.

33 REVERSE()

This function is used to reverse the characters in a string

34 RIGHT()

This function returns the specified rightmost number of characters.

35 RPAD()

This function is used to add padding to the right side of the string until it reaches the desired length.

36 RTRIM()

This function is used to remove trailing spaces.

37 SOUNDEX()

This function returns a soundex string.

38 SPACE()

This function returns a string of the specified number of spaces.

39 STRCMP()

This function is used to compare two given strings.

40 SUBSTR()

This function returns the substring as specified.

41 SUBSTRING()

This function returns the substring as specified.

42 SUBSTRING_INDEX()

This function returns a substring from a string before the specified number of occurrences of the delimiter.

43 TO_BASE64()

This function encodes a string value to base-64 string.

44 TRIM()

This function is used to removes the leading and trailing spaces of the given string.

45 UCASE()

This function is a synonym for UPPER().

46 UNHEX()

This function converts each pair of hexadecimal digits to a character.

47 UPPER()

This function is used to convert the characters in the given string to uppercase.

48 WEIGHT_STRING()

This function returns the weight string value of the given argument.

49 MATCH

This operator is used to search for particular string in the specified list of columns.

50 REGEXP

This operator is similar to the REGEXP_LIKE() function it is used to match a particular pattern in the given string.

51 SOUNDS LIKE

This operator is used to compare the soundex values of two strings.

Advertisements