23. 42. 1. SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len), SUBSTRING(str FROM pos FOR len) |
|
The forms without a len argument return a substring from string str starting at position pos. |
The forms with a len argument return a substring len characters long from string str, starting at position pos. |
If pos is a negative value, the beginning of the substring is from the end of the string. |
The position of the first character is reckoned as 1. |
If len is less than 1, the result is the empty string. |
SUBSTR() is a synonym for SUBSTRING(). |
MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len). |
mysql> SELECT SUBSTRING('ABCDEFGHIJK',5);
+----------------------------+
| SUBSTRING('ABCDEFGHIJK',5) |
+----------------------------+
| EFGHIJK |
+----------------------------+
1 row in set (0.00 sec)
mysql>
|
|