题解 | 网易云音乐推荐(网易校招笔试真题)

网易云音乐推荐(网易校招笔试真题)

https://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7

with t1 as(
select 
    t1.user_id,
    music_id as follow_music_id
from follow t1 left join music_likes t2 on t1.follower_id=t2.user_id 
where t1.user_id=1 
),
t2 as(
select 
    user_id,
    follow_music_id
from t1 
where follow_music_id not in (select  music_id from music_likes where user_id=1)
),
t4 as(
select 
    distinct follow_music_id,
     music_name 
from t2 inner join music on t2.follow_music_id = music.id 
order by follow_music_id
)
select  music_name from t4 

全部评论

相关推荐

牛至超人:把哈工大,再加大加粗,看见闪闪发光的哈工大字样,面试官直接流口水
投递字节跳动等公司6个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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