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

Doctor With the Most Distinct Patients

Return the doctor_id with the largest number of distinct patients seen, and that count.

Table schema

Appointments(id INT PRIMARY KEY, doctor_id INT, patient_id INT)

Sample data

id | doctor_id | patient_id
1 | 1 | 10
2 | 1 | 11
3 | 1 | 10
4 | 2 | 12
5 | 2 | 13
6 | 2 | 14

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.