题解 | #统计每种性别的人数#
统计每种性别的人数
https://www.nowcoder.com/practice/f04189f92f8d4f6fa0f383d413af7cb8
# 题目:现在运营举办了一场比赛,收到了一些参赛申请,表数据记录形式如下所示,现在运营想要统计每个性别的用户分别有多少参赛者,请取出相应结果 /* 1.要筛选出性别: 对于这种有分隔符的文本,可以使用substring_index(text,'分隔符',idx) 2.对性别分组求和即可 */ select substring_index(profile,',',-1) as gender, count(device_id) from user_submit group by gender