当前位置:网站首页>Sql156 average completion rate of each video
Sql156 average completion rate of each video
2022-07-23 23:16:00 【Yuki_ one thousand nine hundred and ninety-nine】
/*
Calculation 2021 In the year 、 Every video with playback record 、 The completion rate of broadcasting ( The result is three decimal places ), And sort them in descending order according to the completion rate
Ideas : Find the smallest unit of processing , Write code from bottom to top , Add restrictions
1、 Disassemble attributive , Find the core decoration : Completion rate
2、 Completion rate = Number of finished broadcasts / Total playback times
——> Number of finished broadcasts : End viewing time - Start playback time >= Number of users with video duration , Deemed as finished broadcasting
end_time-start_time>=duration
** The end of the broadcast is recorded as 1, The unfinished broadcast is 0, all 1 The sum is the completion times
sum(if(end_time-start_time>=duration,1,0))
——> Total playback times : appear start_time For one play
count(start_time)
Knowledge point :if function ,sum function , Left connection ,round function ,year function
1、left join on+ Conditions
2、round(a,3) Keep three decimal places
*/
select a.video_id,round(sum(if(end_time-start_time>=duration,1,0))
/count(start_time),3) avg_comp_play_rate
from tb_user_video_log a
left join tb_video_info b
on a.video_id=b.video_id
where year(start_time)=2021
group by a.video_id
order by avg_comp_play_rate desc
边栏推荐
- FL Studio 20.9 update Chinese version host Daw digital audio workstation
- Preparation for raspberry pie 3B serial port login
- TAP 系列文章4 | 基于 Backstage 的 TAP 开发者门户
- System memory introduction and memory management
- Analysis of mobile semantics and perfect forwarding
- 激光雷达点云数据录制的rosbag文件转换成csv文件
- Remember an experience of being cheated by the Internet
- Diabetes genetic risk testing challenge baseline
- [in depth study of 4g/5g/6g topic -40]: urllc-11 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -5-5g QoS principle and Architecture: slicing, PDU s
- Tensorflow one layer neural network training handwritten digit recognition
猜你喜欢

USB转CAN设备在核酸提取仪 高性能USB接口CAN卡

Leetcode: palindrome number

Ways to improve the utilization of openeuler resources 01: Introduction

Grey correlation analysis (matlab)

Analysis of video capability and future development trend based on NVR Technology

The I2C interface mode offline burning operation method of h7-tool has been released (2022-07-16)

Extract any page number in PDF file with itextpdf

Redis pipeline technology / partition

Build your own target detection environment, model configuration, data configuration mmdetection

Classification model - logistic regression, Fisher linear discriminant (SPSS)
随机推荐
Getting started database days3
Data sorting and usage before torchvision.datasets.imagefolder
USB to can device in nucleic acid extractor high performance USB interface can card
1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
激光雷达点云数据录制的rosbag文件转换成csv文件
AutoCAD advanced operation
Redis管道技术/分区
SecureCRT garbled
Build your own target detection environment, model configuration, data configuration mmdetection
fl studio 20.9更新中文版宿主DAW数字音频工作站
Leetcode: palindrome number
[leetcode ladder] linked list · 203 remove linked list elements
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)
EasyNVR平台如何关闭匿名登录?
Diabetes genetic risk testing challenge advanced
STM32F4查看系统各部分频率
Programming in the novel [serial 16] the moon bends in the yuan universe
ES6 other syntax and extended syntax summary
二,数字逻辑功能单元
1000 okaleido tiger launched binance NFT, triggering a rush to buy