Your question is Top Doctors by Appointment Volume. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Practo's Business Analytics team wants to identify doctors with the highest appointment volume on the Practo platform. Write a PostgreSQL query that joins doctor and appointment data, aggregates appointments by doctor, and returns the top five doctors.
LEFT JOIN.doctor_id ascending to break ties, and return only five doctors.| Column | Type | Description |
|---|---|---|
| doctor_idPK | INTEGER | Unique doctor identifier |
| doctor_name | VARCHAR(100) | Doctor's display name |
| specialization | VARCHAR(100) | Medical specialization |
| Column | Type | Description |
|---|---|---|
| appointment_idPK | INTEGER | Unique appointment identifier |
| doctor_id | INTEGER | Referenced doctor identifier |
| appointment_date | DATE | Date of the appointment |
| status | VARCHAR(20) | Appointment status |