徐若离
徐若离
全部文章
分类
题解(20)
归档
标签
去牛客网
登录
/
注册
徐若离的博客
全部文章
(共18篇)
题解 | #每类视频近一个月的转发量/率#
select t1.tag, sum(t.if_retweet) as retweet_cut,-- 转发量 round(sum(t.if_retweet)/count(t.video_id),3) as retweet_rate from...
Mysql
2022-07-26
0
211
题解 | #平均播放进度大于60%的视频类别#
select t1.tag, concat(ROUND(avg(if(timestampdiff(second,t.start_time,t.end_time)>=t1.duration,1, &nb...
Mysql
2022-07-14
0
146
题解 | #各个视频的平均完播率#
select t.video_id, ROUND(sum(if((t.end_time-t.start_time)>=t1.duration,1,0))/count(start_time),3) as avg_comp_play_rate from tb...
Mysql
2022-07-14
0
220
题解 | #组合 Products 表中的产品名称#
union all 取的是并集。 select prod_name from Products union all select cust_name from Customers order by prod_name;
Mysql
2022-07-11
1
145
题解 | #将两个 SELECT 语句结合起来(一)#
两个表的结合,思路是使用union 函数。 union: 对两个结果集进行并集操作, 不包括重复行,相当于distinct, 同时进行默认规则的排序; union all: 对两个结果集进行并集操作, 包括重复行, 即所有的结果全部显示, 不管是不是重复; select prod...
2022-07-11
0
182
题解 | #计算总和#
from OrderItems group by order_num having total_price>=1000 order by order_num; 解题思路:1⃣️聚合函数+having筛选条件。2⃣️group by order_num,按照order_num分组。
Mysql
2022-06-23
0
145
题解 | #检索产品名称和描述(一)#
from Products where prod_desc LIKE'%toy%'; 题目中要求包含toy,就是用通配符LIKE。内容包含的,需要在字符串两侧都加上%。
Mysql
2022-06-22
1
272
题解 | #浙大不同难度题目的正确率#
sum(if(q1.result='right',1,0))/count(q1.question_id) as correct_rate from question_detail q left join question_practice_detail q1 on q.question_id=q1....
Mysql
2022-06-20
0
124
题解 | #统计每个用户的平均刷题数#
解题思路:1⃣️多表连接 2⃣️用户平均答题量 = 答题总数 / 用户数,要明确答题总数需要用question_id的行数来表示,也就是需对question_id列进行计数,用户数是device_id的行数,其中答题的题目可以重复,用户则不能重复计数 3⃣️where子句筛选univer...
Mysql
2022-06-16
0
137
题解 | #统计每个用户的平均刷题数#
解题思路:1⃣️多表连接 2⃣️用户平均答题量 = 答题总数 / 用户数,要明确答题总数需要用question_id的行数来表示,也就是需对question_id列进行计数,用户数是device_id的行数,其中答题的题目可以重复,用户则不能重复计数 3⃣️where子句筛选univer...
Mysql
2022-06-16
0
194
首页
上一页
1
2
下一页
末页