字符串截取
作者:互联网
Left (A,4)从左边开始截取4个字符
Right(A,4)从右边开始截取4个字符
1987-04-19 -》1987
select left('1987-04-19',4);
###(1)获取员工的入职年份
select ename,hiredate,left(hiredate,4) from emp;
###(2)获取员工的入职工龄
select ename,hiredate,2021 - left(hiredate,4) from emp;
标签:1987,ename,截取,字符串,hiredate,select,left 来源: https://www.cnblogs.com/nuoguo/p/14710570.html