表 employee的两个属性 name和salary
name
John
Franklin
Joyce
Ramesh
James
Jennifer
Ahmad
Alicia
salary
30000
40000
25000
38000
55000
43000
25000
25000
我们将员工的工资水平分为三类,即工资小于30000为低工资,工资大于等于30000且小于50000为中等工资,工资大于等于50000为高工资。请显示所有员工的姓名及其对应的工资水平。
------解决方案--------------------
select
name,
case when salary <3000 then '低工资 ' when salary > =50000 then '高工资 ' else '中等工资 ' end
from employee
------解决方案--------------------
select name , 工资水平 = case when salary < 3000 then '低工资 '
when salary > = 3000 and salary < 5000 then '中等工资 '
when salary > = 3000 then '高工资 '
from tb
------解决方案--------------------
select name , 工资水平 = case when salary < 3000 then '低工资 '
when salary > = 3000 and salary < 5000 then '中等工资 '
when salary > = 3000 then '高工资 '
end
from employee
------解决方案--------------------
select
name,
case when salary <3000 then '低工资 '
when salary > =50000 then '高工资 '
else '中等工资 ' end
from employee
------解决方案--------------------
Select [name],Case When salary <3000 Then '低工资 ' When salary > =50000 Then '高工资 ' Else '中等工资 ' End 工资水平 From employee Order By 工资水平
代码迷推荐解决方案:软件开发者薪资,http://www.daimami.com/other/1391128.html