Friend Suggestions (Friends of Friends)
Hard
Advanced Queries
Suggest friends of friends: for each user return every user they are not yet friends with who shares at least one mutual friend, with the number of mutual friends. Friendships are stored once per pair and are mutual. Order by user, suggestion.
Table schema
Friends(user1 INT, user2 INT)Sample data
user1 | user2
1 | 2
2 | 3
3 | 4
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.