SQL188 牛客直播各科目出勤率
首先需要对attend_tb表进行预处理,把一天内多次登录的数据只保留一条数据,避免出现重复计算,同时筛选出观看时长大于等于10的数据
with t1 as (
select distinct
user_id,course_id
from
attend_tb
where
timestampdiff(minute,in_datetime,out_datetime)>=10
)
select
behavior_tb.course_id
,course_name
,round(count(t1.user_id)*100/sum(if_sign),2) `attend_rate(%)`
from
course_tb right join behavior_tb on course_tb.course_id=behavior_tb.course_id
left join t1 on behavior_tb.course_id=t1.course_id and
behavior_tb.user_id=t1.user_id
group by
behavior_tb.course_id,course_name
order by
course_id asc
with t1 as (
select distinct
user_id,course_id
from
attend_tb
where
timestampdiff(minute,in_datetime,out_datetime)>=10
)
select
behavior_tb.course_id
,course_name
,round(count(t1.user_id)*100/sum(if_sign),2) `attend_rate(%)`
from
course_tb right join behavior_tb on course_tb.course_id=behavior_tb.course_id
left join t1 on behavior_tb.course_id=t1.course_id and
behavior_tb.user_id=t1.user_id
group by
behavior_tb.course_id,course_name
order by
course_id asc
全部评论
相关推荐
八股战士0offer:虽然但是,你想表达的应该是学习如何agent工程里的提示词工程,而不是训练或者微调模型,这基本上是两个不同的方向。我认为学习agent主要就两个东西:提示词工程和上下文工程。像你说的prompt caching这种优化怎么能想到,建议多读大模型供应商尤其是anthropic的博客,anthropic大概一年前就有很详细的博客讲最佳实践和实现了 点赞 评论 收藏
分享
点赞 评论 收藏
分享