Your question is SQL DISTINCT Query. Start with the requirements and the three 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.
An innovative healthcare organization uses its Care Insights platform to review diagnoses recorded during patient encounters. Write a PostgreSQL query that returns distinct diagnosis codes and names for qualifying encounters.
2025-01-01.| Column | Type | Description |
|---|---|---|
| patient_idPK | INT | Unique patient identifier |
| patient_name | VARCHAR(100) | Patient display name |
| status | VARCHAR(20) | Current patient status |
| Column | Type | Description |
|---|---|---|
| encounter_idPK | INT | Unique encounter identifier |
| patient_id | INT | Patient associated with the encounter |
| encounter_date | DATE | Date the encounter occurred |
| status | VARCHAR(20) | Encounter workflow status |
| Column | Type | Description |
|---|---|---|
| diagnosis_idPK | INT | Unique diagnosis record identifier |
| encounter_id | INT | Encounter associated with the diagnosis |
| diagnosis_code | VARCHAR(20) | Clinical diagnosis code |
| diagnosis_name | VARCHAR(150) | Human-readable diagnosis name |