题解 | #某乎问答高质量的回答中用户属于各级别的数量#

某乎问答高质量的回答中用户属于各级别的数量

https://www.nowcoder.com/practice/69c85db3e59245efb7cee51996fe2273

# 3/22 8:56 ~ 9:08  12min
# 字段:level_cut,num
# 暂且认为高质量回答可以重复
# 
# tb1:标记等级区间
with tb1 as(
    select author_id,
        case 
        when author_level between 5 and 6 then '5-6级'
        when author_level between 3 and 4 then '3-4级'
        when author_level between 1 and 2 then '1-2级' 
        else '其他等级' end as level_cut
        from author_tb
)

select level_cut,count(char_len) as num
FROM answer_tb LEFT JOIN tb1 using(author_id)
WHERE char_len >= 100
GROUP BY level_cut
order by count(char_len)  desc

全部评论

相关推荐

投递大华股份等公司10个岗位
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务