排名

用户解题统计

过去一年提交了

勋章 ①金银铜:在竞赛中获得第一二三名;②好习惯:自然月10天提交;③里程碑:解决1/2/5/10/20/50/100/200题;④每周打卡挑战:完成每周5题,每年1月1日清零。

收藏

收藏日期 题目名称 解决状态
没有收藏的题目。

评论笔记

评论日期 题目名称 评论内容 站长评论
2024-12-27 哔哩哔哩面试真题(1)按日分摊会员收入 
看答案才发现题目里的日期应该改成2020年11月20日,太坑了。。
啥也没说
2024-12-01 滴滴面试真题(2)打车订单呼叫应答时间 
答案有问题?示例的代码跑出来也不对
“未经审视的代码不值得运行🐶,读码-修改-运行,也是一种学习。我挖陷阱了😜”
题解有这句话的,意思是不要直接运行。

正确答案我可以直接给你,先给你一些提示吧

如果不做任何过滤,直接相减,则取消时间=1970-01-01 00:00:00的订单,也会被包含进去。
需要再过滤一层哦。

提交记录

提交日期 题目名称 提交代码
2025-02-19 人均消费金额定档标签 
with temporary as (
select mch_nm,count(distinct cust_uid) as customer,sum(trx_amt) as amount
from mt_trx_rcd1
group by mch_nm
)
select mch_nm,
round(amount/customer,4) as avg_spending,
(case when amount/customer<100 then "低档"
when amount/customer>=100 and amount/customer <300 then "中档"
else "高档" end) as label
from temporary
order by amount/customer asc
2025-02-19 人均消费金额定档标签 
with temporary as (
select mch_nm,count(distinct cust_uid) as customer,sum(trx_amt) as amount
from mt_trx_rcd1
group by mch_nm
)
select mch_nm,
round(amount/customer,4) as avg_spending,
(case when amount/customer<100 then "低档"
when amount/customer>=100 and amount/customer <300 then "中档"
else "高档" end) as label
from temporary
2025-02-19 人均消费金额定档标签 
with temporary as (
select mch_nm,count(distinct cust_uid) as customer,sum(trx_amt) as amount
from mt_trx_rcd1
group by mch_nm
)
select mch_nm,
round(amount/customer,4) as avg_spending,
(case when amount/customer<100 then "低档"
when 100<=amount/customer<300 then "中档"
else "高档" end) as label
from temporary
2025-02-19 餐饮类别丰富度标签 
with table1 as(
select cust_uid,count(distinct mch_typ2) as types
from mt_trx_rcd1
group by cust_uid
)
select cust_uid,
(case when types>=7 then 1 else 0 end) as label
from table1
2025-02-18 整体的点击率 
select
count(search_tm) as total_searches,
count(click_page_id)as total_clicks,
round(count(click_page_id) * 100/count(search_tm),2) as click_rate
from 
jx_query_rcd as j1
left join
jx_click_rcd as j2
on j1.session_id=j2.session_id
2025-02-18 分关键词的搜索UV转化率 
with table_temp as (
select j1.usr_id as usr1,j2.usr_id as usr2,key_word
from 
jx_query_rcd as j1 
left join
jx_click_rcd as j2
on j1.session_id=j2.session_id 
)
select key_word,
count(distinct usr1) as total_search_users,
count(distinct usr2) as users_reached_product_page,
round(count(distinct usr2)*100/count(distinct usr1),2) as uv_conversion_rate
from table_temp
group by key_word
order by uv_conversion_rate desc
limit 10
2025-02-18 分关键词的搜索UV转化率 
with table_temp as (
select j1.usr_id as usr1,j2.usr_id as usr2,key_word
from 
jx_query_rcd as j1 
left join
jx_click_rcd as j2
on j1.session_id=j2.session_id 
)
select key_word,
count(distinct usr1) as total_search_users,
count(distinct usr2) as users_reached_product_page,
round(count(distinct usr1)*100/count(distinct usr2),2) as uv_conversion_rate
from table_temp
group by key_word
order by uv_conversion_rate desc
limit 10
2025-02-18 分关键词的搜索UV转化率 
with table_temp as (
select j1.usr_id as usr1,j2.usr_id as usr2,key_word
from 
jx_query_rcd as j1 
left join
jx_click_rcd as j2
on j1.session_id=j2.session_id 
)
select key_word,
count(distinct usr1) as total_search_users,
count(distinct usr2) as users_reached_product_page,
round(count(distinct usr1)*100/count(distinct usr2),2) as uv_conversion_rate
from table_temp
group by key_word
2025-02-18 整体搜索UV转化率 
select count(distinct j1.usr_id) astotal_search_users,
count(distinct j2.usr_id)as users_reached_product_page,
round(count(distinct j2.usr_id)*100/count(distinct j1.usr_id),2)
from 
jx_query_rcd as j1
left join 
jx_click_rcd as j2
on j1.session_id=j2.session_id
2025-02-18 整体搜索UV转化率 
select count(distinct j1.usr_id) astotal_search_users,
count(distinct j2.usr_id)as users_reached_product_page,
round(count(distinct j2.usr_id)/count(distinct j1.usr_id),2)
from 
jx_query_rcd as j1
left join 
jx_click_rcd as j2
on j1.session_id=j2.session_id
2025-02-18 整体搜索UV转化率 
select count(distinct j1.usr_id) astotal_search_users,
count(distinct j2.usr_id)as users_reached_product_page,
round(count(distinct j2.usr_id)/count(distinct j1.usr_id),2)
from 
jx_query_rcd as j1
left join 
jx_click_rcd as j2
on j1.usr_id=j2.usr_id
2025-02-18 整体搜索UV转化率 
select count(distinct j1.usr_id) astotal_search_users,
count(distinct j2.usr_id)as users_reached_product_page,
round(count(distinct j2.usr_id)*100/count(distinct j1.usr_id),2)
from 
jx_query_rcd as j1
left join 
jx_click_rcd as j2
on j1.usr_id=j2.usr_id
2025-02-11 得物面试真题(3)第一单为Mac的用户 
with table_contemp as (
select user_id,product_type,
rank()over(partition by user_id order by purchase_time asc) as rk,
(case when product_type='Mac' then 1 else 0 end) as tag
from apple_pchs_rcd
)
select distinct(user_id),
tag
from table_contemp
where rk=1
2025-02-11 得物面试真题(3)第一单为Mac的用户 
SELECT 
    user_id,
    CASE 
        WHEN product_type = 'Mac' THEN 1
        ELSE 0
    END AS tag
FROM (
    SELECT 
        user_id,
        product_type,
        ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY purchase_time ASC) AS rn
    FROM apple_pchs_rcd
) AS subquery
WHERE rn = 1
ORDER BY user_id;
2025-02-11 得物面试真题(3)第一单为Mac的用户 
with table_contemp as (
select user_id,product_type,
rank()over(partition by user_id order by purchase_time asc) as rk
from apple_pchs_rcd
)
select distinct(user_id),
(case when rk='1' and product_type='Mac' then 1 else 0 end) as tag
from table_contemp
2025-02-11 得物面试真题(3)第一单为Mac的用户 
with table_contemp as (
select user_id,product_type,
rank()over(partition by user_id order by purchase_time asc) as rk
from apple_pchs_rcd
)
select user_id,
(case when rk='1' and product_type='Mac' then 1 else 0 end) as tag
from table_contemp
2025-02-11 得物面试真题(2)每月人均下单数 
select
month,
count(order_id) as total_orders,
count(distinct user_id) as unique_users,
round(count(order_id) /count(distinct user_id),2) as avg_orders_per_user
from (
select date_format(purchase_time,'%Y-%m') as month,
order_id,
user_id
from apple_pchs_rcd) as table1
group by month
2025-02-11 得物面试真题(1)每周iPhone用户和非iPhone用户 
with table_contemp as(
select user_id,product_type,yearweek(purchase_time,1) as week_number
from apple_pchs_rcd
)
select 
week_number,
(case when product_type='iPhone'then 'iPhone' else 'Not iPhone' end) as category,
count(distinct(user_id))as user_count 
from table_contemp
group by category,week_number
order by week_number,category asc
2025-02-11 得物面试真题(1)每周iPhone用户和非iPhone用户 
with table_contemp as(
select user_id,product_type,yearweek(purchase_time,1) as week_number
from apple_pchs_rcd
)
select 
week_number,
(case when product_type='iPhone'then 'iPone' else 'Not iPhone' end) as category,
count(distinct(user_id))as user_count 
from table_contemp
group by category,week_number
order by week_number,category asc
2025-02-11 得物面试真题(1)每周iPhone用户和非iPhone用户 
with table_contemp as(
select user_id,product_type,yearweek(purchase_time,1) as week_number
from apple_pchs_rcd
)
select 
week_number,
(case when product_type='iPhone'then 'iPone' else 'Not iPone' end) as category,
count(distinct(user_id))as user_count 
from table_contemp
group by category,week_number
order by week_number,category asc