A social network stores every accepted friend request once in request_accepted. Both people become friends with each other, so a person's friend count includes requests they sent and requests they accepted. If several people tie for the most friends, return all of them. Write an SQL query that returns id and num (the number of friends) for the most-connected person or people. Order the results by id ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.