mysql> SELECT SUBSTRING('computer',3) AS col1, -> SUBSTRING('computer',3,4) AS col2, -> SUBSTRING('computer',-3) AS col3, -> SUBSTRING('computer',-5,3) AS col4; +--------+------+------+------+ | col1 | col2 | col3 | col4 | +--------+------+------+------+ | mputer | mput | ter | put | +--------+------+------+------+ 1 row in set (0.00 sec)SUBSTRING('computer',3) 返回从第 3 个位置开始到字符串结尾的子字符串,结果为“mputer”;SUBSTRING('computer',3,4) 返回从第 3 个位置开始长度为 4 的子字符串,结果为“mput”;
本文链接:http://task.lmcjl.com/news/12558.html