念_长征
念_长征
全部文章
分类
归档
标签
去牛客网
登录
/
注册
念_长征的博客
全部文章
(共166篇)
题解 | #2021年国庆司机统计信息#
# 平均接单数:司机总接单数/司机数,打车订单表有多少条记录就接单多少次 # 平均兼职收入:总费用/司机数 # 计算平均接单数和平均兼职收入 select (select "北京") city,round(count(o.id)/count(distinct driver_id...
2024-07-31
0
82
题解 | #零食类商品中复购率top3高的商品#
# 先将订单总表中退款的订单剔除,后连接订单明细表,于是形成各商品销售情况表 with k1 as( select t1.order_id, t1.uid, event_time, status, product_id, price, cnt from ( select * from...
2024-03-15
0
200
题解 | #某宝店铺动销率与售罄率#
# 连接两个子查询表,并选取合适字段按题目要求计算值 select k1.style_id, round(ifnull(sku_saled_num,0)/(inventory_num-ifnull(sku_saled_num,0))*100,2) `pin_rate(%)`, round(gmv/b...
2024-03-09
0
204
题解 | #某宝店铺折扣率#
# 首先知道折扣率是指,销售总价/gmv总额 select round(sum(sales_price)/sum(sales_num*tag_price)*100,2) `discount_rate(%)` from sales_tb s join product_tb p on s.item_i...
2024-03-09
0
192
题解 | #某乎问答11月份日人均回答量#
select answer_date, round(count(*)/count(distinct author_id),2) per_num from answer_tb group by answer_date order by answer_date;
2024-02-29
0
192
题解 | #统计活跃间隔对用户分级结果#
# 根据题目含义可知,要根据用户活跃天数来分类用户,使用分组查询和窗口函数 # 将用户行为日志每条记录的in_time和out_time提取作为两条记录 with t as( select uid, in_time hy_time from tb_user_log union...
2024-02-29
0
232
题解 | #计算商城中2021年每月的GMV#
select date_format(event_time, '%Y-%m') month, floor(sum(total_amount)) GMV from tb_order_overall where status <> 2 and year(event_time) = '2021...
2024-02-28
0
216
题解 | #2021年11月每天新用户的次日留存率#
select dt, round(avg(if_re is not null), 2) uv_left_rate from ( # 然后将新用户登录记录表与tb_user_log按特定条件连接 select t2.uid, date(f_in) dt, min(in_time) if...
2024-02-28
0
190
题解 | #今天的刷题量(一)#
# 用curdate()来返回今天的日期 select name, cnt from ( select subject_id, count(*) cnt from submission where create_time = curdate() group by su...
2024-02-27
0
178
题解 | #最差是第几名(二)#
# 先查询各分数段最差的排名及其上一等级的最差排名(即得出各分数段涵盖人数的范围)----表(1) select grade, ifnull(lag(rank_l,1)over(order by rank_l),0) rank_f, rank_l from ( select grade, s...
2024-02-27
0
205
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页