mysql>
mysql> SELECT SUBSTRING('ABCDEFGHIJK', -5, 3);
+---------------------------------+
| SUBSTRING('ABCDEFGHIJK', -5, 3) |
+---------------------------------+
| GHI |
+---------------------------------+
1 row in set (0.00 sec)
mysql>
23.42.SUBSTRING |
| 23.42.1. | SUBSTRING(str,pos), SUBSTRING(str FROM pos), SUBSTRING(str,pos,len), SUBSTRING(str FROM pos FOR len) |
| 23.42.2. | SUBSTRING('ABCDEFGHIJK' FROM 4); |
| 23.42.3. | SUBSTRING('ABCDEFGHIJK',5,6); |
| 23.42.4. | SUBSTRING('ABCDEFGHIJK', -3); |
| 23.42.5. | SUBSTRING('ABCDEFGHIJK', -5, 3); |
| 23.42.6. | SUBSTRING('ABCDEFGHIJK' FROM -4 FOR 2); |
| 23.42.7. | Use SUBSTRING with data in a table |