Write a SQL query to find the top 3 most frequent diagnoses per hospital.
Use the provided hospital and patient diagnosis data. Exclude records with a NULL diagnosis. If frequencies tie, order diagnoses alphabetically to produce a deterministic top-three result.
hospital_name, diagnosis, diagnosis_count, and diagnosis_rank.| Column | Type | Description |
|---|---|---|
| hospital_idPK | INT | Unique hospital identifier |
| hospital_name | VARCHAR(100) | Hospital name |
| region | VARCHAR(50) | Hospital service region |
| Column | Type | Description |
|---|---|---|
| diagnosis_idPK | INT | Unique diagnosis record identifier |
| hospital_id | INT | Hospital associated with the diagnosis record |
| diagnosis | VARCHAR(100) | Recorded patient diagnosis |
| diagnosed_on | DATE | Date the diagnosis was recorded |