A brief analysis of MySQL string function

  • 2020-06-03 08:35:40
  • OfStack

1. left function, which intercepts the string content of query field, USES select left(content,50) as summary from article; In this case, this means querying only the first 50 characters of the contents of the content column, and in this case the character is treated as only 1 character.

2. The right function, as opposed to the left function, intercepts the content from behind.

3. upper function, uppercase processing of lowercase letters in the query content. select upper(title) as title from article;

4. The lower function, as opposed to upper, is lowercase.

5. substr function, which clips a string from a specified position to a specified length, is more flexible than left and right. from article (content, 10, 50) from article, intercept 50 characters from the 10th character (the first character is 1, not 0); select substr(content,10) from article, truncated from the 10th character to the end; select substr(content, �20) from article, 20 characters from the end.

Related articles: