题解 | #每个月Top3的周杰伦歌曲#

每个月Top3的周杰伦歌曲

https://www.nowcoder.com/practice/4ab6d198ea8447fe9b6a1cad1f671503

with t as(
    select month(fdate) as 'month',
           row_number() over(partition by month(fdate) order by count(*) desc,song_id) as ranking,
           song_name,
           count(*) as play_pv
    from play_log
    join song_info using(song_id)
    join user_info using(user_id)
    where year(fdate)='2022' 
    and age>=18 and age<=25 
    and singer_name='周杰伦'
    group by month(fdate),song_name,song_id
)

select *
from t where ranking<=3

区间取值,不可以用18<=age<=25,自测通过,提交不通过。

可以用age between 18 and 25,或者age>=18 and age<=25.

全部评论

相关推荐

gelmanspar...:奖学金删掉,自我评价删掉,简历压缩一下,写一页
如果再来一次,你还会学机...
点赞 评论 收藏
分享
10-29 15:51
嘉应学院 Java
后端转测开第一人:你把简历的学历改成北京交通大学 去海投1000份发现基本还是没面试
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务