努力虚心学习
努力虚心学习
全部文章
分类
归档
标签
去牛客网
登录
/
注册
努力虚心学习的博客
全部文章
(共6篇)
题解 | 请写出计算粉丝ctr的sql语句
简单思路,多表连接,根据题目要求写连接条件,最后作为临时表或者子查询,在主查询中计算粉丝ctr; with integration as( select b.author_id, b.content_id, a.fans_id, ...
2025-07-11
0
44
题解 | 统计用户从访问到下单的转化率 - 简单思路
考虑到用户每天的重复浏览和下单行为对于用户转化率的计算而言均视为一个计量单位,因此创建两张临时表分别对访问表和下单表的用户id进行去重处理并统计个数,再分别作为分母和分子,使用主查询求出每日的用户转化率; with visit_user as( select date(visit_time)...
2025-07-07
1
51
题解 | 使用子查询的方式找出属于Action分类的所有电影对应的title,description
--从内层开始往外写,逻辑就很通顺了 select title, description from film where film_id in ( select film_id from film_category where category_id = ( ...
2025-07-01
1
49
题解 | 推荐内容准确的用户平均评分
简单思路,欢迎大家指点:使用concat拼接函数,将准确的用户喜好和用户拼接起来,在原表中进行匹配,返回匹配成功的分数并求平均即可。 select avg(score) as avg_score from user_action_tb where concat(user_id, hobby_l) i...
2025-05-07
0
40
题解 | 统计所有课程参加培训人次
union all暴力解题简单思路(跳过处理空值步骤直接分组求和,最后汇总个数即可):with tmp as( select count(case when course like '%course1%' then 1 else NULL end) as course_nums from...
2025-05-05
3
61
题解 | 21年8月份练题总数
select count(a.device_id) as did_cnt, sum(a.num) as question_cnt from( select device_id, count(question_id) num from question_practice_detail ...
2025-04-06
1
85