Your question is Handle Missing Values in SQL. Start with the requirements and the one table 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.
Providence analytics teams need consistent encounter fields before using clinical records in reporting and downstream analysis. Write a PostgreSQL query against the clinical_encounters table that handles missing pain scores and discharge dispositions using CASE WHEN logic.
encounter_id.pain_score with 0 in a column named standardized_pain_score.discharge_disposition with Unknown in a column named standardized_disposition, while preserving existing values.| Column | Type | Description |
|---|---|---|
| encounter_idPK | INT | Unique clinical encounter identifier |
| patient_id | INT | Identifier for the patient |
| encounter_date | DATE | Date of the encounter |
| care_setting | VARCHAR(30) | Setting where care was delivered |
| pain_score | INT | Patient-reported pain score from 0 to 10 |
| discharge_disposition | VARCHAR(30) | Patient destination or outcome at discharge |