Chapter 8 · Window Functions
10. Cumulative Billing Report
Medium20 XPHealthcare
Finance needs a cumulative billing report. For each billing record, show the id, billed_at, amount, and a running_total of amount ordered by billed_at. Use a window function.
Tables
- 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.