自定义排序: 若sex为空,则将数据排在最后面; select * from student order by case ISNULL(SEX,'') when '' then 2 else 1 end