风飞飞飞
风飞飞飞
全部文章
分类
题解(57)
归档
标签
去牛客网
登录
/
注册
风飞飞飞的博客
全部文章
(共64篇)
题解 | #统计活跃间隔对用户分级结果#
select user_grade, round(count(user_grade)/(select count(distinct uid) from tb_user_log),2) as ratio from (select uid, case when min(day_...
Mysql
2022-03-29
0
399
题解 | #2021年11月每天新用户的次日留存率#
select min_time,round(count(t2.uid)/count(t1.uid),2) as uv_left_rate from (select uid,min(date(in_time)) as min_time from tb_user_log grou...
Mysql
2022-03-29
0
293
题解 | #每篇文章同一时刻最大在看人数#
select artical_id,max(num_cnt) as max_uv from (select artical_id, sum(num) over(partition by artical_id order by read_time asc,num desc) as nu...
Mysql
2022-03-28
0
347
题解 | #近一个月发布的视频中热度最高的top3视频#
select video_id, round((100*watch_rate+5*like_cnt+3*comment_cnt+2*retweet_cnt)/(no_watch_cnt+1)) as hot_index from (select log.video_id, avg(i...
Mysql
2022-03-27
0
396
题解 | #国庆期间每类视频点赞量和转发量#
select tag,dt,sum_like_cnt_7d,max_retweet_cnt_7d from (select tag,dt, sum(like_cnt) over(partition by tag order by dt rows 6 preceding) as sum_like_cn...
Mysql
2022-03-26
0
344
题解 | SQL50#纠错4#
分析 使用union组合查询时,只能使用一条order by字句,他必须位于最后一条select语句之后,因为对于结果集不存在对于一部分数据进行排序,而另一部分用另一种排序规则的情况。 代码 SELECT cust_name, cust_contact, cust_email FROM Custo...
Mysql
2022-03-05
77
1684
题解 | SQL49#组合 Products 表中的产品名称和 Customers 表中的顾客名称#
分析 关键词:union 用法: union--连接表,对行操作。 union--将两个表做行拼接,同时自动删除重复的行。 union all---将两个表做行拼接,保留重复的行 代码 select prod_name from Products union select cust_name ...
Mysql
2022-03-05
41
1559
题解 |SQL48 #将两个 SELECT 语句结合起来(二)#
分析 关键词:where, or 代码 select prod_id,quantity from OrderItems where quantity=100 or prod_id like 'BNBG%' order by prod_id
Mysql
2022-03-05
1
663
题解 | SQL47#将两个 SELECT 语句结合起来(一)#
分析 关键词:union 用法: join---连接表,对列操作 union--连接表,对行操作。 union--将两个表做行拼接,同时自动删除重复的行。 union all---将两个表做行拼接,保留重复的行。 思路: 筛选条件:like用法。where quantity=1...
Mysql
2022-03-05
71
1894
题解 | SQL46#列出供应商及其可供产品的数量#
分析 关键词:left join 用法: 内联结:inner join。取两列的交集。 外联结: left join。左连接,以左边表的列为主,取两列的交集,对于不在右边列存在的名称取null。 right join。右连接,以右边表的列为主,取两列的交集,对于不在左边列存在的名称取null。 ...
Mysql
2022-03-05
13
791
首页
上一页
1
2
3
4
5
6
7
下一页
末页