Updating into string functions

Rated 4.68/5 based on 886 customer reviews

Returns the numeric value of the leftmost character of the string str. SELECT ASCII('2'); --------------------------------------------------------- | ASCII('2') | --------------------------------------------------------- | 50 | --------------------------------------------------------- 1 row in set (0.00 sec) mysql SELECT ASCII('dx'); --------------------------------------------------------- | ASCII('dx') | --------------------------------------------------------- | 100 | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT BIN(12); --------------------------------------------------------- | BIN(12) | --------------------------------------------------------- | 1100 | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT BIT_LENGTH('text'); --------------------------------------------------------- | BIT_LENGTH('text') | --------------------------------------------------------- | 32 | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT CHAR(77,121,83,81,'76'); --------------------------------------------------------- | CHAR(77,121,83,81,'76') | --------------------------------------------------------- | My SQL | --------------------------------------------------------- 1 row in set (0.00 sec) Returns the length of the string str, measured in characters. ASCII() works for characters with numeric values from 0 to 255.'); --------------------------------------------------------- | RPAD('hi',5,'? ') | --------------------------------------------------------- | hi??? | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT RTRIM('barbar '); --------------------------------------------------------- | RTRIM('barbar ') | --------------------------------------------------------- | barbar | --------------------------------------------------------- 1 row in set (0.00 sec) Returns a soundex string from str.Two strings that sound almost the same should have identical soundex strings.SELECT EXPORT_SET(5,'Y','N',',',4); --------------------------------------------------------- | EXPORT_SET(5,'Y','N',',',4) | --------------------------------------------------------- | Y, N, Y, N | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo'); --------------------------------------------------------- | FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo') | --------------------------------------------------------- | 2 | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT FIND_IN_SET('b','a,b,c,d'); --------------------------------------------------------- | SELECT FIND_IN_SET('b','a,b,c,d') | --------------------------------------------------------- | 2 | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT FORMAT(12332.123456, 4); --------------------------------------------------------- | FORMAT(12332.123456, 4) | --------------------------------------------------------- | 12,332.1235 | --------------------------------------------------------- 1 row in set (0.00 sec) If N_or_S is a number, returns a string representation of the hexadecimal value of N, where N is a longlong (BIGINT) number. If N_or_S is a string, returns a hexadecimal string representation of N_or_S where each character in N_or_S is converted to two hexadecimal digits.SELECT HEX(255); --------------------------------------------------------- | HEX(255) | --------------------------------------------------------- | FF | --------------------------------------------------------- 1 row in set (0.00 sec) mysql SELECT 0x616263; --------------------------------------------------------- | 0x616263 | --------------------------------------------------------- | abc | --------------------------------------------------------- 1 row in set (0.00 sec) Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr.

'); --------------------------------------------------------- | LPAD('hi',4,'?? ') | --------------------------------------------------------- | ?? hi | --------------------------------------------------------- 1 row in set (0.00 sec) SELECT LTRIM(' barbar'); --------------------------------------------------------- | LTRIM(' barbar') | --------------------------------------------------------- | barbar | --------------------------------------------------------- 1 row in set (0.00 sec) Returns a set value (a string containing substrings separated by .,.

characters) consisting of the strings that have the corresponding bit in bits set. SELECT MAKE_SET(1,'a','b','c'); --------------------------------------------------------- | MAKE_SET(1,'a','b','c') | --------------------------------------------------------- | a | --------------------------------------------------------- 1 row in set (0.00 sec) MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len). SELECT OCT(12); --------------------------------------------------------- | OCT(12) | --------------------------------------------------------- | 14 | --------------------------------------------------------- 1 row in set (0.00 sec) OCTET_LENGTH() is a synonym for LENGTH().

str1 corresponds to bit 0, str2 to bit 1, and so on. Returns a string representation of the octal value of N, where N is a longlong (BIGINT) number. If the leftmost character of the string str is a multi-byte character, returns the code for that character, calculated from the numeric values of its constituent bytes using this formula − SELECT ORD('2'); --------------------------------------------------------- | ORD('2') | --------------------------------------------------------- | 50 | --------------------------------------------------------- 1 row in set (0.00 sec) POSITION(substr IN str) is a synonym for LOCATE(substr,str).

The first argument is the separator for the rest of the arguments.

The separator is added between the strings to be concatenated.

Leave a Reply