题解 | #网易云音乐推荐(网易校招笔试真题)#
网易云音乐推荐(网易校招笔试真题)
https://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7
with follower as (
select follower_id
from follow
where user_id ='1'
),
follower_music as (
select distinct mu.music_name,mu.id
from follower fo,music_likes ml,music mu
where fo.follower_id=ml.user_id and ml.music_id=mu.id
),
user_1_music as (
select mu_1.music_name
from music_likes ml_1,music mu_1
where ml_1.music_id=mu_1.id and ml_1.user_id = '1'
)
SELECT music_name
FROM follower_music
WHERE music_name NOT IN (
SELECT music_name
FROM user_1_music
) order by id;
