题解 | #统计每种性别的人数#

统计每种性别的人数

https://www.nowcoder.com/practice/f04189f92f8d4f6fa0f383d413af7cb8

select
(
    case when profile like '%,male' then 'male'
    else 'female' end
) as gender,count(device_id)
from user_submit
group by gender;

# 如果count里面是distinct device_id
# 结果的gender会反序,变成female在第一行,male在第二行,不知为何。

全部评论

相关推荐

用微笑面对困难:加急通知你不合适,也很吗有礼貌了你。
点赞 评论 收藏
分享
迷茫的大四🐶:💐孝子启动失败,改为启动咏鹅
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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