Write a SQL query to find 2nd-degree connections (friends of friends) for users.
Asked in the coding round stage. SQL half of the DE coding round.
user_id, user_name, second_degree_user_id, second_degree_user_name, and mutual_friend_count.user_id, then second_degree_user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| display_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| friendship_idPK | INT | Unique friendship relationship row |
| user_id | INT | User initiating the directed friendship record |
| friend_id | INT | Connected user's identifier |