题解 | #统计每种性别的人数#
统计每种性别的人数
https://www.nowcoder.com/practice/f04189f92f8d4f6fa0f383d413af7cb8
SUBSTRING_INDEX的用法
SUBSTRING_INDEX(string,'分隔符',n[从起始取到第n个分隔符前])
SUBSTRING_INDEX(string,'分隔符',-n[从倒数第n个分隔符后取到结束])
select gender, count(*) as number from ( select SUBSTRING_INDEX(profile,',',-1) as gender from user_submit ) tab group by gender