Guided Notes
Joining Patients, Encounters & Diagnoses
INNER and LEFT joins, join keys, table aliases, one-to-many relationships, and joining three tables to answer clinical questions without duplicating rows.
Why joins
Slide 1 / 5Answers usually need several tables: patient demographics (patients), visits (encounters), and diagnoses (diagnoses). A JOIN combines rows where keys match: SELECT p.last_name, e.enc_type, e.admit_date FROM encounters e JOIN patients p ON p.patient_id = e.patient_id; • e and p are aliases. • ON states the matching rule.
