614.(Medium)二级关注者
在 facebook 中,表 follow 会有 2 个字段: followee, follower ,分别表示被关注者和关注者。
请写一个 sql 查询语句,对每一个关注者,查询关注他的关注者的数目。
比方说:
应该输出:
注意:
被关注者永远不会被他 / 她自己关注。 将结果按照字典序返回。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/second-degree-follower
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
Solution
自连接
子查询
Last updated
Was this helpful?