Skip to content
SQL interview questions

HealthNow

Healthcare / EMR

HealthNow is an electronic medical records (EMR) system used by a network of clinics and a hospital. It records patients, visits (outpatient, emergency and inpatient stays), ICD-10 diagnosis codes, lab results with reference ranges and prescriptions. Healthcare analysts use this kind of data for readmission rates, chronic-disease control, care gaps and doctor workload, all common topics in health-tech SQL interviews. All patients in the dataset are fictional.

See the HealthNow tables

HealthNow schema

All tables live in the healthnow schema, so write healthnow.clinics in your queries.

healthnow.clinics

Clinics and departments in the network.

  • clinic_id (INT) — PK
  • name (VARCHAR(80))
  • city (VARCHAR(40))
  • clinic_type (VARCHAR(20)) — 'primary_care', 'specialty', 'hospital'

healthnow.doctors

Doctors and their specialty.

  • doctor_id (INT) — PK
  • full_name (VARCHAR(80))
  • specialty (VARCHAR(30))
  • clinic_id (INT) — FK → clinics.clinic_id

healthnow.patients

Registered patients (fictional).

  • patient_id (INT) — PK
  • full_name (VARCHAR(80))
  • dob (DATE) — date of birth
  • gender (VARCHAR(1)) — 'F', 'M', 'O'
  • city (VARCHAR(40))
  • registered_at (DATE)
  • insurance_type (VARCHAR(12)) — 'private', 'government', 'self_pay'

healthnow.diagnoses

ICD-10 codes used in the network.

  • diagnosis_code (VARCHAR(10)) — PK
  • description (VARCHAR(120))
  • category (VARCHAR(12)) — 'chronic', 'acute', 'preventive'

healthnow.visits

One row per encounter. Inpatient visits have a discharge date.

  • visit_id (INT) — PK
  • patient_id (INT) — FK → patients.patient_id
  • doctor_id (INT) — FK → doctors.doctor_id
  • clinic_id (INT) — FK → clinics.clinic_id
  • visit_date (DATE) — admission date for inpatient stays
  • visit_type (VARCHAR(12)) — 'outpatient', 'emergency', 'inpatient'
  • diagnosis_code (VARCHAR(10)) — FK → diagnoses.diagnosis_code; primary diagnosis
  • discharge_date (DATE) — nullable; inpatient only
  • bill_amount (DECIMAL(10,2)) — INR

healthnow.lab_results

Lab tests ordered during visits, with the reference range used.

  • lab_id (INT) — PK
  • visit_id (INT) — FK → visits.visit_id
  • test_type (VARCHAR(20)) — 'HbA1c', 'LDL', 'Fasting glucose', 'Hemoglobin', 'Creatinine'
  • result_value (DECIMAL(6,2))
  • result_unit (VARCHAR(10)) — '%', 'mg/dL', 'g/dL'
  • reference_low (DECIMAL(6,2))
  • reference_high (DECIMAL(6,2))
  • result_flag (VARCHAR(6)) — 'NORMAL', 'HIGH', 'LOW' as recorded by the lab system
  • result_date (DATE)

healthnow.medications

Prescriptions written during visits.

  • med_id (INT) — PK
  • visit_id (INT) — FK → visits.visit_id
  • drug_name (VARCHAR(40))
  • dosage_mg (INT)
  • freq_per_day (INT)
  • start_date (DATE)
  • end_date (DATE) — nullable; planned end; NULL for open-ended prescriptions

Beginner (10)

  • BeginnerPatients by cityOpen now
  • BeginnerThe 10 oldest patientsOpen now
  • BeginnerVisits in the last 30 days by type
  • BeginnerChronic diagnosis codes
  • BeginnerDoctors per specialty
  • BeginnerHbA1c results of 6.5% or more (last 90 days)
  • BeginnerEmergency visits by clinic
  • BeginnerPrescriptions currently running
  • BeginnerPatients registered this year
  • BeginnerAverage bill by visit type

Intermediate (12)

  • IntermediatePatients with the most visits (last 12 months)
  • IntermediateMost common diagnoses (last 12 months)
  • IntermediatePatients by age band
  • IntermediateDoctor workload (last 90 days)
  • IntermediateOut-of-range rate by lab test
  • IntermediatePatients not seen in 12 months
  • IntermediateAverage length of stay by diagnosis
  • IntermediatePatients on 4 or more current drugs
  • IntermediateDiabetic patients overdue for HbA1c
  • IntermediateMonthly billing by clinic
  • IntermediateVisits without any recorded lab result
  • IntermediateDistinct patient count versus visit count per doctor

Advanced (22)

  • Advanced30-day readmission rate
  • AdvancedHbA1c: first vs latest result per patient
  • AdvancedTypical gap between visits
  • AdvancedDoctor ranking within each clinic
  • AdvancedPatients with both diabetes and hypertension
  • AdvancedEmergency visits: daily count and 7-day average
  • AdvancedFrom diagnosis to first prescription
  • AdvancedData quality: lab flags that don't match the value
  • AdvancedFrequent emergency department users
  • AdvancedHypertension visits with an amlodipine prescription, by doctor
  • AdvancedMidnight inpatient occupancy with half-open stays
  • AdvancedLatest patient/test measurement with deterministic ties
  • AdvancedOverlapping prescriptions for the same patient and drug
  • AdvancedLab values exactly at reference boundaries
  • AdvancedClinic and diagnosis billing grouping sets
  • AdvancedPatients consistently attending one clinic
  • AdvancedA bounded JSON patient visit timeline
  • AdvancedPatients with visits but no prescription ever recorded
  • AdvancedExplain a patient history date-range lookup
  • AdvancedVisits outside a doctor's current clinic
  • AdvancedAdd an initially unvalidated data-quality constraint
  • AdvancedInspect row-level security rather than assuming patient filters authorize

Mock interview round (5)

  • AdvancedMock round 1: Clinic scorecard for last month
  • AdvancedMock round 2: Diabetes control rate
  • AdvancedMock round 3: Readmissions by diagnosis
  • AdvancedMock round 4: Do new patients come back?
  • AdvancedMock round 5: High-risk heart failure patients

Choose optional cookies

We use necessary cookies for account security. With your permission, we also use analytics and advertising cookies on marketing pages. See our Privacy Policy.