MySQL functions-string functions, mysql function strings

Source: Internet
Author: User
Tags mysql functions

MySQL functions-string functions, mysql function strings

CHAR_LENGTH (str) returns the number of characters in str

LENGTH (str) returns the LENGTH of str bytes.

CONCAT (str1, str2....) returns the concatenation of str1, str2..... If there is a null value, null is returned.

CONCAT_WS (x, str1, str2. ..) --- concat with separator the first parameter x represents the delimiter, followed by a string

If x is NULL, return NULL. If the string is NULL, it is ignored.

INSERT (s1, x, len, s2) string replace s1 target string x with the start position of s1 (subscript starts from 1) len with the length of x s2 is the string to be replaced

If x exceeds the length subscript of s1, return s1. If len is greater than x, replace all

LOWER (str), LCASE (str) string to lowercase

Convert UPPER (str) and UCASE (str) strings to uppercase

LEFT (str, n) returns n characters to the leftmost of the str string.

RIGHT (str, n) returns n characters at the rightmost of the str string.

LPAD (s1, len, s2) returns s2 from the left side of s1 until the total length is len. If len <s1 length, s2 is not filled, returns the len Length from the left of s1.

RPAD (s1, len, s2) returns s2 from the right side of s1 to the length of len. If len <s1 length, s2 is not filled, returns the len Length from the left of s1.

LTRIM (S) delete space on the left RTRIM (s) delete space on the right TRIM (s) delete spaces on both sides

TRIM (s1 FROM s2) deletes the s1 string at both ends of s2.

REPEAT (s, n) returns a string consisting of n s, n <= 0, returns NULL; s or n is NULL, returns NULL

SPACE (n) returns n SPACE strings

REPLACE (s, s1, s2) returns the result of replacing all s1 strings in s WITH s2.

STRCPM (s1, s2) s1 = s2 returns 0 s1 <s2 returns-1 s1> s2 returns 1

SUBSTRING (s, n, len), MID (s, n, len) returns the string of len Length s starting from n. If n <0, it is truncated from the last n to the last of s. If n = 0, an empty string is returned. len can omit-truncates all characters after n.

LOCATE (str1, str2), POSITION (str1 IN str2), INSTR (str2, str1) returns the starting POSITION of str1 IN str2.

REVERSE (s) returns the REVERSE string of s.

ELT (n, str1, str2, str3. ..) returns the nth string in str1, str2.. If n is exceeded, null is returned.

FIELD (s, str1, str2, str3....) returns the position where s first appears in str1, str2...., no 0 is returned.

 

FIND_IN_SET (s, str1) returns the position where s appears in str1. str1 is a list separated by commas (,).

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.