目录
0 需求
字段:店铺id(shop_id),销量(sale),商品id(commodity_id)
求每个店铺商品销量排名的中位数
1 分析
(1)数据准备
create table shop_test ( shop_id string, commodity_id string, sale int )row format delimited fields terminated by '\t'; insert into shop_test values ('110','1',10), ('110','2',20), ('110','3',30), ('110','4',50), ('110','5',60), ('110','6',20), ('110','7',80), ('111','1',90), ('111','2',80), ('111','3',50), ('111','4',70), ('111','5',20), ('111','6',10);
查看数据
<