AnalystPath

Most Connected Co-Author

SQLMediumMid level~15 min

Problem

A research database records confirmed co-authorships between two researchers.

```
Coauthorship
+-------------+------+
| Column | Type |
+-------------+------+
| lead_id | int |
| partner_id | int |
| paper_date | date |
+-------------+------+
(lead_id, partner_id) is the primary key.
```

Each row means `lead_id` and `partner_id` co-authored a paper together, so both researchers gain one collaboration link. Find the researcher who has the most collaboration links. The test data guarantees exactly one such researcher.

Return that researcher's `researcher_id` and their number of links as `links`.

Tables

Example rows — the live problem includes the full dataset.

Coauthorship
lead_idpartner_idpaper_date
122021-06-03
132021-06-08
232021-06-08

Expected output

Your answer should return 1 row with the columns researcher_id, links.

Starter code (SQL)

SELECT *
FROM Coauthorship;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions