select name, if(score<60, '不及格', if(score<75, '中等', if(score<85,'良好', '优秀'))) as rank from students;
后面需要分类操作可以使用group by 对rank项目进行操作
score 代表成绩栏位
select case
when score < 60 then
'不及格'
when score>60 and score<=80 then
'中等'
when score>80 and score<=90 then
'良好'
else
'优秀'
end
from 现表