题解 | 网易云音乐推荐(网易校招笔试真题)
SELECT DISTINCT music_name FROM (SELECT DISTINCT f.user_id, follower_id, music_id FROM follow f LEFT JOIN music_likes ml ON follower_id = ml.user_id WHERE f.user_id = 1 ORDER BY music_id ) a INNER JOIN music ON a.music_id = music.id WHERE music_id NOT IN (SELECT music_id FROM music_likes WHERE user_id = 1);
注:理清f表中的关注关系。