题解 | #提取博客URL中的用户名#
提取博客URL中的用户名
https://www.nowcoder.com/practice/26c8715f32e24d918f15db69518f3ad8
select device_id, substring(blog_url,11) user_name from user_submit
大佬们分享其他方法
法1:字符串函数
select device_id,
substring_index(blog_url,'/',-1) as user_name
# substr(blog_url,11) as user_name
from user_submit;
法2:替换函数
select
device_id,
replace('http:/url/','') as user_name
from user_submit
;
法3:trim函数
select
device_id ,
trim('http:/url/' from blog_url) as user_name
from user_submit