SUBSTRはSUBSTRINGのシノニム
起点は0じゃなくて1なので
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'
以下やると無になる
mysql> SELECT SUBSTRING('Quadratically',1,6); +--------------------------------+ | SUBSTRING('Quadratically',1,6) | +--------------------------------+ | Quadra | +--------------------------------+ 1 row in set (0.17 sec) mysql> SELECT SUBSTRING('Quadratically',0,6); +--------------------------------+ | SUBSTRING('Quadratically',0,6) | +--------------------------------+ | | +--------------------------------+ 1 row in set (0.03 sec)