题解 | #查看不同年龄段的用户明细#

查看不同年龄段的用户明细

http://www.nowcoder.com/practice/ae44b2b78525417b8b2fc2075b557592

case when 条件1  then 结果1
when 条件2  then  结果2
when 条件3  then  结果3
else  结果4   end
这就相当于if  
                  else if
                  else if
                  else
select device_id, gender,
    (case when age >= 20 and age < 25 then "20-24岁"
     when age < 20 then "20岁以下"
    when age >= 25 then '25岁及以上'
    else '其他' end ) as age_cut
from user_profile


全部评论

相关推荐

爱吃肉的伊登在写日记:好棒,27届简历能做成这个样子,但是第一个项目感觉cover住难度还是不小的,特别是二面的时候肯定要对分布式系统设计这一块儿有高出正常面试者的水平才行
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务