- LEFT 返回字符串中从左边开始指定个数字符
LEFT(character_expression,integer_expression);
- RIGTH 返回字符串从右边开始指定个数字符
RIGHT(character_expression,integer_expression);
SELECT LEFT('abcedf',3); -- 返回从左侧数前 3 个字符,第二个参数不接收负数,会报错
SELECT RIGHT('abcedf',3); -- 返回从右侧数前 3 个字符
SELECT * FROM Subject WHERE ID=4;
SELECT *,LEFT(Description,10) AS New_Description FROM Subject WHERE ID=4;
SELECT *,RIGHT(Description,10) AS New_Description FROM Subject WHERE ID=4;
image.png
网友评论