题解 | #网易云音乐推荐(网易校招笔试真题)#
网易云音乐推荐(网易校招笔试真题)
http://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7
SELECT DISTINCT
c.music_name
FROM
follow a
JOIN
music_likes b ON a.follower_id = b.user_id
JOIN
music c ON b.music_id = c.id
WHERE
a.user_id = 1
AND b.music_id NOT IN (SELECT
music_id
FROM
music_likes
WHERE
user_id = 1)
ORDER BY c.id;