Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Friend Suggestions (Friends of Friends)

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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.