MID

2024-12-02 03:48:26  Updated

Syntax

MID(str,pos,len)

Purpose

MID() returns a substring of str. The start position is pos, and the length of the substring is len characters. If any argument is NULL, the function returns NULL.

  • If len is not specified, the returned substring starts from the position pos till the end of str.

  • If the value of pos is negative, the start position is reversely determined from the end of str.

  • If len is less than or equal to 0, or the start position specified by pos is invalid, an empty string is returned.

This function is the alias of the SUBSTRING(str,pos,len) function.

Examples

obclient> SELECT MID('OceanBase',6);
+--------------------+
| MID('OceanBase',6) |
+--------------------+
| Base               |
+--------------------+
1 row in set

Contact Us