select first_name from employees order by substr(first_name,-2)

select first_name from employees order by right(first_name,2)

分割字符串:

1,从左开始截取字符串 left(str,length)

例:

select first_name from employees order by left(first_name,1)desc

2,从右开始截取字符串

right(str,length)

select first_name from employees order by right(first_name,2)

3,截去字符串 substring(str,pos)

substring(被截取字段,从第几位开始截取,截取长度)

select first_name from employees order by substr(first_name,-2)

4,按关键字截取字符串

substring_index(str,delim,count)

substring_index(被截取字段,关键字,关键字出现的次数)