当前位置:网站首页>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;
边栏推荐
- 腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
- 【系统分析师之路】第五章 复盘软件工程(软件过程改进)
- Illustration creating a stored procedure using Navicat for MySQL
- 资源变现小程序开通流量主教程
- 一次 Keepalived 高可用的事故,让我重学了一遍它!
- Multi terminal collaboration of Huawei accounts to create a better internet life
- 损失函数:DIOU loss手写实现
- Unity脚本的基础语法(3)-访问游戏对象组件
- 常用的ui组件
- Development of unity script program
猜你喜欢

jmeter 学习笔记

SQL编程问题,测试用例不通过

IDEA 2021.3 执行 golang 报错:RNING: undefined behavior version of Delve is too old for Go version 1.18

Methodology for troubleshooting problems (applicable to troubleshooting problems arising from any multi-party cooperation)

QT read / write excel--qxlsx worksheet display / hide status setting 4
![[kali] Kali system, software update (with image source)](/img/ac/43a3f81d50ab6866271b500b142252.png)
[kali] Kali system, software update (with image source)

On the simplification and acceleration of join operation

顺应媒体融合趋势,中科闻歌携手美摄打造数智媒宣

ABAP toolbox v1.0 (with implementation ideas)

你想要的异常知识点都在这里了
随机推荐
Js根据相同值将数组转换为二维数组
Unity脚本的基础语法(3)-访问游戏对象组件
Introduction to the new source code of substrat: fix the memory leak of the mission engine of beefy, and optimize the smart contract deletion queue
【系统分析师之路】第五章 复盘软件工程(敏捷开发)
2022-06-23 帆软部分公式及sql生成(月份、季度取数)
Unity Animator 参数
Unity脚本的基础语法(5)-向量
Introduction to two types of rxjs observable operators
Basic syntax of unity script (3) - accessing game object components
今日睡眠质量记录80分
Matlab tips (22) matrix analysis -- stepwise regression
Paper interpretation (AGC) attributed graph clustering via adaptive graph revolution
Package based on thinkphp5 -tronapi- wave field interface - source code without encryption - can be opened twice - interface document attached - detailed guidance of the author - June 30, 2022 08:45:2
JS converts an array to a two-dimensional array based on the same value
Basics of golang -- the difference between slicing and array
Exploring the source code of Boca Cross Chain Communication: Elements
WTM重大更新,多租户和单点登录
腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
ERROR: Cannot uninstall ‘PyYAML‘. It is a distutils installed project and thus we cannot accurately
postman 自动生成 curl 代码片段