当前位置:网站首页>SQL programming problem, test case failed
SQL programming problem, test case failed
2022-06-30 13:25:00 【CSDN Q & A】
Topic content
problem : Calculation 2021 The completion rate of each video recorded in the year ( The result is three decimal places ), And sort them in descending order according to the completion rate
notes : Video completion rate refers to the proportion of completed playback times to the total playback times . Simplicity , The difference between the end viewing time and the start playing time >= Video duration , It is deemed to have finished playing .
user - Video interactive table tb_user_video_log

Short video message table tb_video_info

Here is my code , No problem outputting use cases , But the test case fails , The test case fails all the time

SELECT
video_id,
round(avg(CASE WHEN SECOND(TIMEDIFF(end_time, start_time)) >= duration THEN 1
ELSE 0
END),3) avg_comp_play_rate
FROM
tb_user_video_log
JOIN
tb_video_info USING (video_id)
WHERE
YEAR(start_time) = 2021 and YEAR(end_time) = 2021
GROUP BY video_id
ORDER BY avg_comp_play_rate DESC;
边栏推荐
- Tronapi- wavefield interface - source code without encryption - can be opened in two places - interface document attached - encapsulation based on thinkphp5 - detailed guidance of the author - 21:59:3
- [deep anatomy of C language] storage principle of float variable in memory & comparison between pointer variable and "zero value"
- Rk356x u-boot Institute (command section) 3.3 env related command usage
- [recruitment (Guangzhou)] Chenggong Yi (Guangzhou) Net core middle and Senior Development Engineer
- 损失函数:DIOU loss手写实现
- golang 基础 —— 字符串 与 int 、int64 互转
- Paper interpretation (AGC) attributed graph clustering via adaptive graph revolution
- Event handling in QT
- 服务线上治理
- 优思学院:六西格玛不只是统计!
猜你喜欢

Dark horse notes -- wrapper class, regular expression, arrays class

The independent station is Web3.0. The national "14th five year plan" requires enterprises to build digital websites!

SQL考勤统计月报表

60 divine vs Code plug-ins!!

Data Lake (11): Iceberg table data organization and query
![[kali] Kali system, software update (with image source)](/img/ac/43a3f81d50ab6866271b500b142252.png)
[kali] Kali system, software update (with image source)

postman 自動生成 curl 代碼片段

Database usage in QT

Read all the knowledge points about enterprise im in one article

写信宝小程序开源
随机推荐
Wechat applet reports an error: typeerror: cannot read property 'SetData' of undefined
损失函数:DIOU loss手写实现
Unity脚本程序的开发
golang基础 —— 切片几种声明方式
MySQL implements the division of two query results
Mqtt ROS simulates publishing a custom message type
postman 自动生成 curl 代码片段
navicat数据库建表是没有utf8选项。
你想要的异常知识点都在这里了
uniapp支付之APP微信支付unicloud版(附源码)
Kaniko official documents - build images in kubernetes
Today's sleep quality record 80 points
Mysql根据经纬度查询半径多少以内的数据,画个圈圈查数据库
golang 基础 —— 字符串 与 int 、int64 互转
数据库表为什么写不进数据了
【C】深入理解指针、回调函数(介绍模拟qsort)
资源变现小程序开通流量主教程
【C语言深度解剖】float变量在内存中存储原理&&指针变量与“零值”比较
ABAP toolbox v1.0 (with implementation ideas)
ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we cannot accurately