substring_index
统计每种性别的人数
题目链接
SELECT substring_index(profile,',',-1) AS gender,COUNT(*) AS number
FROM user_submit
GROUP BY gender;
截取出年龄
题目链接
SELECT substring_index(substring_index(profile,',',3),',',-1) AS age,
COUNT(device_id) AS number
FROM user_submit
GROUP BY age;
提取博客URL中的用户名
题目链接
SELECT device_id,substring_index(blog_url,'/',-1) AS user_name
FROM user_submit