Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Readmission Rate

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL Readmission Rate. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Children's Hospital of Philadelphia uses discharge data to monitor readmissions. Write a PostgreSQL query that calculates the percentage of discharged admission episodes followed by a subsequent admission within 30 days.

Assume next_admission_date contains the next known admission date for the patient. Count an admission occurring exactly 30 days after discharge as a readmission. Exclude records without a discharge date from the denominator.

Requirements

  1. Return one row with the readmission rate as readmission_rate_pct, rounded to two decimal places.
  2. Use discharged admission episodes as the denominator and include only subsequent admissions from the discharge date through 30 days afterward.

Schema

admissions
ColumnTypeDescription
admission_idPKINTUnique admission identifier
patient_idINTPatient identifier
discharge_dateDATEDate the admission ended
next_admission_dateDATENext known admission date for the patient
Tablesadmissions
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results