Coding Test

Leetcode - 614. Second Degree Follower

Indo Yoon

문제

Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

정답

SELECT DISTINCT Follow.follower, FC.num
FROM Follow
JOIN (
    SELECT followee, count(*) AS num
    FROM Follow
    GROUP BY followee) AS FC
ON Follow.follower = FC.followee
ORDER BY Follow.follower