Chapter 5 · JOINs
71. Patient Out-of-Pocket Exceeding Insurance Coverage
Medium20 XPHealthcare
Find visits where the patient's responsibility exceeded the insurance-covered portion. Return the patient's full name, visit_date, amount, insurance_covered, patient_responsibility, and the difference (patient_responsibility - insurance_covered) as overpay_gap. Only include rows where the gap is positive. Sort by overpay_gap descending.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- date_of_birthTEXT
- genderTEXT
- emailTEXT
- phoneTEXT
- blood_typeTEXT
- cityTEXT
- stateTEXT
- FKinsurance_id→ insurance.idINT
- created_atTIMESTAMP
- PKidINT
- FKpatient_id→ patients.idINT
- FKdoctor_id→ doctors.idINT
- visit_dateTEXT
- diagnosisTEXT
- notesTEXT
- follow_up_dateTEXT
- statusTEXT
- PKidINT
- FKvisit_id→ visits.idINT
- amountREAL
- insurance_coveredREAL
- patient_responsibilityREAL
- statusTEXT
- billed_atTEXT
- paid_atTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.