用到的知识点:三表连接、分组聚合、开窗函数排序(row_number()over())、日期函数、最后别忘了排序和取Top3的歌曲(用到子查询)。提交时发现窗口函数排序时需要先按播放次数降序,再按歌曲id升序排序,才能获得正确答案。最终代码如下。 select sub.month,sub.ranking,sub.song_name,sub.play_pv from( select month(fdate) month,row_number()over(partition by month(fdate) order by count(p.user_id) desc,s.song_id) rank...