Loading the editor…
Calculate the percent of claims denied in each department.
Revenue cycle compares denial rates, not just denied dollars. A submitted claim is not a denial. Rate is denied claims divided by all claims, as a whole-number percent.
Return department, claims, denied_claims, and denial_percent. denial_percent is denied claims times 100, divided by the number of claims, using integer division. Sort by denial_percent descending, then department.
| id | name | birth_date | sex | city |
|---|---|---|---|---|
| 1 | Amina Yusuf | 1984-04-12 | F | Lagos |
| 2 | Hugo Berger | 1972-11-03 | M | Berlin |
| 3 | Mei Lin | 1990-06-21 | f | Shanghai |
| id | patient_id | department | started_on | ended_on | visit_type |
|---|---|---|---|---|---|
| 1 | 1 | Cardiology | 2025-01-06 | 2025-01-06 | outpatient |
| 2 | 1 | Cardiology | 2025-03-02 | 2025-03-04 | inpatient |
| 3 | 2 | Orthopedics | 2025-01-11 | 2025-01-11 | outpatient |
| id | encounter_id | code | description |
|---|---|---|---|
| 1 | 1 | I10 | Essential hypertension |
| 2 | 2 | I21.9 | Acute myocardial infarction |
| 3 | 3 | M17.1 | Knee osteoarthritis |
| id | encounter_id | billed_cents | paid_cents | status | submitted_on |
|---|---|---|---|---|---|
| 1 | 1 | 18000 | 15000 | paid | 2025-01-07 |
| 2 | 2 | 240000 | 198000 | paid | 2025-03-06 |
| 3 | 3 | 22000 | 0 | denied | 2025-01-12 |
Ctrl or Cmd + Enter runs the query. The database resets on every run.
Run the query to see rows from the sample database.
Next exercise: User signup cohorts
Related: Collections by department, Rank departments by cash collected