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