主要是 sql 截取字符串方法:

从左到右截取,就用 left(field/string,length);

从右到左截取,就用 right(field/string,length);

指定位置开始截取,substring_index(str,s,count);

从字符第 count 次出现的位置开始截取字符串(count可为符负数,若找不到指定字符,则返回整个字符串)就用 substring(field/string,start,length)。 本题从右向左截取两位,作为排序依据即可:

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