视星等无穷
视星等无穷
全部文章
题解
归档
标签
去牛客网
登录
/
注册
视星等无穷的博客
全部文章
/ 题解
(共22篇)
题解 | #国庆期间近7日日均取消订单量#
写一个不用窗口函数的题解~ 第一步,计算2021年10月1号到10月3号近七天的完成订单总数和取消订单总数 select distinct date(order_time) dt, (select sum(if(start_time is null,0,1)) from tb_get_car_ord...
Mysql
2022-04-22
19
1173
题解 | #每个城市中评分最高的司机信息#
1.先计算所有司机的平均评分,平均订单数,平均里程 select city, driver_id,avg(grade) avg_grade, count(order_id)/count(distinct date(order_time)) avg_order_num, sum(mileage)/co...
Mysql
2022-04-21
17
722
题解 | #有取消订单记录的司机平均评分#
1.筛选出有过退单记录的司机 select driver_id from tb_get_car_order where start_time is null 2.统计分数平均,保留一位小数 round(avg(grade),1) 3.汇总列 ifnull(driver_id,'总体') wit...
Mysql
数据库
2022-04-20
2
421
题解 | #2021年国庆在北京接单3次及以上的司机统计信息#
1.t1表 2021年国庆7天在北京接单3次及以上的司机的接单数目和收入数目 注意司机接单但被用户取消的订单也算在接单数内 2.计算平均接单数和平均兼职收入 select '北京' as city, round(avg(cnt),3) avg_order_num, round(avg(income)...
Mysql
2022-04-19
3
548
题解 | #店铺901国庆期间的7日动销率和滞销率#
参考了大佬的思路 注意外层查询的别名是可以在子查询中使用的 select distinct dt, round(cnt/total_cnt,3) sale_rate,round(1-cnt/total_cnt,3) unsale_rate from #统计10月1号到10月3号近7天的在销售产品数 ...
Mysql
2022-04-18
2
346
题解 | #10月的新户客单价和获客成本#
第一步 得到所有满足条件的订单(用户初次,2021年10月)的金额和优惠金额表t1 第二步 对得到的金额和优惠金额求平均 with t1 as (select min(total_amount) amount,sum(price*cnt)-min(total_amount) cost from tb...
Mysql
2022-04-16
4
445
题解 | #各个视频的平均完播率#
select t1.video_id, round(sum(if(end_time-start_time-duration>=0,1,0))/count(*),3) avg_comp_play_rate from tb_user_video_log t1 join tb_video_info ...
Mysql
2022-04-15
1
255
题解 | #某店铺的各商品毛利率及店铺整体毛利率#
1.统计每个零食类商品每个用户在近90天内的购买次数 with t1 as( select t1.product_id, t2.uid,count(t2.uid) cnt from tb_product_info t1 join tb_order_detail t3 on t1.product_i...
Mysql
2022-04-15
2
302
题解 | #某店铺的各商品毛利率及店铺整体毛利率#
1.计算每个订单中的销售额和进价总额 select t1.order_id,t1.product_id,shop_id,price*cnt sales,in_price*cnt inprice from tb_order_detail t1 join tb_order_overall t2 on t...
Mysql
2022-04-14
1
273
题解 | #统计2021年10月每个退货率不大于0.5的商品各项指标#
第一步,按照商品计算2021年10月的点击数,展示数,加购数,付款数,退款数 第二步,计算商品点展比=点击数÷展示数; 加购率=加购数÷点击数; 成单率=付款数÷加购数;退货率=退款数÷付款数,并筛选退货率不大于0.5的 with t1 as( select product_id, sum(if_...
Mysql
2022-04-14
1
348
首页
上一页
1
2
3
下一页
末页