Write SQL queries that involve joins.
Use the supplied relational tables to return one result for every patient record, including patients without encounters. Include only the requested output columns and sort the results as specified.
patient_id, patient_name, encounter_count, total_charge, and last_encounter_date.patient_name ascending, then patient_id ascending.| Column | Type | Description |
|---|---|---|
| patient_idPK | INT | Unique patient identifier |
| patient_name | VARCHAR(120) | Patient's full name |
| birth_date | DATE | Patient's date of birth |
| Column | Type | Description |
|---|---|---|
| encounter_idPK | INT | Unique encounter identifier |
| patient_id | INT | Referenced patient identifier |
| encounter_date | DATE | Date of the encounter |
| charge | NUMERIC(10,2) | Charge associated with the encounter |
| encounter_status | VARCHAR(30) | Current encounter status |