题解 | 网易云音乐推荐(网易校招笔试真题)

网易云音乐推荐(网易校招笔试真题)

https://www.nowcoder.com/practice/048ed413ac0e4cf4a774b906fc87e0e7

关键:子查询的使用。

注意:select中为distinct时,order by中只能引用select中出现的字段,否则需要先使用子查询得到distinct字段和排序根据字段,再在外层select...order by...

select music_name
from(
    select distinct music_name,ml.music_id
    from follow f join music_likes ml on f.follower_id=ml.user_id
    join music m on ml.music_id=m.id
    where ml.music_id not in (
        select music_id
        from music_likes
        where user_id=1
    ) and f.user_id=1
) t
order by music_id

全部评论

相关推荐

程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务