Healthcare Analytics Path · Mission 13 of 25Medium

Readmission rate by insurance type

Use CASE WHEN for rate calculation, LOWER() for normalization, and multi-table JOINs

Back to Healthcare Analytics

The Brief

Dr. Amara OkaforChief Quality Officerquality-analytics

Calculate the 30-day readmission rate by insurance type. Use the readmission_flag in quality metrics. Normalize insurance type so 'Medicare' and 'medicare' are grouped together. Show insurance type, total encounters with a readmission metric, readmissions, and readmission rate as a percentage rounded to 1 decimal.

You'll practice

CASELOWER()Percentages

Tables available

fact_quality_metricsfact_encountersdim_patients

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Three tables chain together: the metric links to the encounter, which links to the patient. Filter the metric_type upfront

Hint 2

Compute two quantities per group — totals and readmissions — and divide. Normalize the grouping key so casing doesn't split rows

Hint 3

`SELECT LOWER(p.insurance_type) AS insurance_type, COUNT(*) AS total_encounters, SUM(CASE WHEN qm.metric_value = 1 THEN ___ ELSE ___ END) AS readmissions, ROUND(100.0 * SUM(CASE WHEN qm.metric_value = 1 THEN 1 ELSE 0 END) / ___, 1) AS readmission_rate ... GROUP BY LOWER(___)`