题解 | 网易云音乐推荐(网易校招笔试真题)
网易云音乐推荐(网易校招笔试真题)
https://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7
with t1 as (select *, id id1 from music_likes l join music m on l.music_id = m.id where l.user_id in (select follower_id from follow where user_id = 1) order by id ), t2 as (select id id2 from music_likes l join music m on l.music_id = m.id where l.user_id = 1 ) select music_name from (select distinct music_name, t1.id from t1 left join t2 on t1.id1 = t2.id2 where t2.id2 is null order by t1.id ) tt