select ename,sal,
case when sal<=2000 then 'underpaid'
when sal>=4000 then 'overpaid'
else 'ok'
end as status
from emp
针对查询的返回值执行条件逻辑,可以给case表达式取别名,else可以忽略,返回null
select ename,sal,
case when sal<=2000 then 'underpaid'
when sal>=4000 then 'overpaid'
else 'ok'
end as status
from emp
针对查询的返回值执行条件逻辑,可以给case表达式取别名,else可以忽略,返回null