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

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

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

with follow_music as(
select
a.user_id as uid,
a.follower_id as fid,
b.music_id as fmid
from follow  as a
left join music_likes as b
on a.follower_id = b.user_id
where a.user_id = 1
)
select
music_name
from 
(select distinct
c.fmid,
e.music_name as music_name
from follow_music  as c
left join music_likes as d
on c.uid = d.user_id 
and c.fmid = d.music_id
left join music as e
on c.fmid = e.id
where d.music_id is null) as t1
order by t1.fmid  -- 用内层带出来的 fmid 排序

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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