substr

description

Syntax

VARCHAR substr(VARCHAR content, INT start, INT length)

求子字符串,返回第一个参数描述的字符串中从start开始长度为len的部分字符串。首字母的下标为1。

example

  1. mysql> select substr("Hello doris", 2, 1);
  2. +-----------------------------+
  3. | substr('Hello doris', 2, 1) |
  4. +-----------------------------+
  5. | e |
  6. +-----------------------------+
  7. mysql> select substr("Hello doris", 1, 2);
  8. +-----------------------------+
  9. | substr('Hello doris', 1, 2) |
  10. +-----------------------------+
  11. | He |
  12. +-----------------------------+

keywords

  1. SUBSTR