题解 | #截取出年龄# 截取两遍是关键

截取出年龄

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

正确题解:

select
substring_index(substring_index(profile,',',3),',',-1) as age, #重点
count(device_id) as number
from user_submit
group by age

⚠️Stella的两个迷糊点:

  1. 因为age在中间所以要截取两遍,才可以截取到
  2. 直接使用substring_index()时提取,不需要自己用case再分类

#sql练习日常#
全部评论

相关推荐

04-25 19:29
已编辑
宁波大学 运营
被普调的六边形战士很高大:你我美牛孩
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务