Use WHERE IS NULL to filter for active admissions and JOIN to get patient names
how many patients are currently admitted? discharge_date is null for anyone still here. need count and their names + admit dates. capacity meeting at 8.
| Column | Type | Key |
|---|---|---|
| encounter_id | INT | PK |
| patient_id | INT | FK → dim_patients |
| provider_id | INT | FK → dim_providers |
| department_id | INT | FK → dim_departments |
| admit_date | TEXT | |
| discharge_date | TEXT | |
| diagnosis_code | TEXT | |
| diagnosis_description | TEXT | |
| encounter_type | TEXT | |
| discharge_disposition | TEXT |
| Column | Type | Key |
|---|---|---|
| patient_id | INT | PK |
| first_name | TEXT | |
| last_name | TEXT | |
| date_of_birth | TEXT | |
| gender | TEXT | |
| insurance_type | TEXT | |
| zip_code | TEXT | |
| primary_language | TEXT | |
| is_deceased | INT |
Each hint you reveal reduces the XP you can earn. Try the query first.
An active admission is defined by missing discharge data in `fact_encounters`. Patient names are in `dim_patients`
Filter for rows where discharge hasn't happened yet, then join to get the human-readable patient info
`SELECT p.first_name, p.last_name, e.admit_date FROM fact_encounters e JOIN dim_patients p ON ___ WHERE e.discharge_date IS ___`