Mysql string truncation function 1. Extract string left (str, length) from left. Description: left (truncated field, truncated length) Example: select left (content, 200) as abstract from my_content_t 2. Extract the right (str, length) string from the right. Description: right (intercepted field, truncated length) Example: select right (content, 200) as abstract from my_content_t 3. truncation string substring (str, pos) substring (str, pos, length) Description: substring (truncated field, starting from the nth digit) substring (truncated field, starting from the nth digit and intercepting the length) Example: select substring (content, 5) as abstract from my_content_tselect Substring (content, 5,200) as abstract from my_content_t (Note: if the number of digits is negative, for example,-5, it is the length from the last digit to the end or truncation of the string) 4. truncate the string substring_index (str, delim, count). Description: substring_index (truncated field, keyword, number of times the keyword appears). Example: select substring_index ("blog.jb51.net ",". ", 2) as abstract from my_content_t result: blog. jb51 (Note: if the number of times the keyword appears is negative, for example,-2, it is counted FROM the last to the end of the string) function Introduction: SUBSTRING (str, pos), SUBSTRING (str FROM pos) SUBSTRING (str, pos, len), SUBSTRING (str FROM pos FOR len) returns a substring from str without the len parameter format, starting with position pos. The format with the len parameter returns a substring with the same length as the len character from the string str, starting from the position pos. Use the FROM format as the standard SQL syntax. It may also use a negative value for pos. In this case, the position of the substring starts with the pos character at the end of the string, rather than the start position of the string. You can use a negative value for pos in the following format.