substring(filed,m):截取filed字段從第m個字符開始到結束的字符串;
substring(filed,m,n):截取filed字段從第m個字符開始的長度為n的字符串;
str,字符
pos,從第幾個開始取
下面看個實例
MySQL> select substring('quadratically',5);
-> 'ratically'
MySQL> select substring('foobarbar' from 4);
-> 'barbar'
MySQL> select substring('quadratically',5,6);
-> 'ratica'
MySQL> select substring('sakila', -3);
-> 'ila'
MySQL> select substring('sakila', -5, 3);
-> 'aki'
MySQL> select substring('sakila' from -4 for 2);
-> 'ki'