题解 | 商品id数据清洗统计
商品id数据清洗统计
https://www.nowcoder.com/practice/c985ecbd820b46e6bafa858f6600126d
select
#substring_index(order_id, '_', -1) as product_id,
regexp_substr(order_id, 'p[0-9]+$') as product_id,
count(*) as cnt
from
order_log
group by
product_id
order by
product_id
limit
1;
substring_index:按照分隔符提取子字符串的函数,适用于处理有规律的分隔文本
regexp_substr:更强大的字符匹配函数
