SevyDevy

Design a hospital management system database

PremiumDatabase designMedium

  • ER diagram
  • Medical records
  • Appointment scheduling

Quick answer

This database design interview question asks you to design a hospital management system database. Aim for a design that stores data correctly and serves its main queries well, then explain the schema, keys, indexes and trade-offs. Interviewers want to see how you model entities, choose keys and design for the real access patterns.

The problem

Design the database for a hospital management system serving a group of 12 hospitals. Patients book appointments with doctors, get admitted to beds, receive prescriptions and lab tests, and are billed. The hard parts are no double booking, versioned clinical records and logging every view of medical data.

Patients register once and may visit any hospital. Doctors, nurses and admin staff see different parts of a record, and every view or change of a patient's medical data must be logged for audits.

What must a hospital management system database do?

  • Patient record: Find a patient by hospital ID, phone number or name and date of birth; show demographics, allergies, active conditions, current medications and the visit timeline.
  • Appointments: Show a doctor's free 15-minute slots for a day; book one; a doctor cannot be double-booked; a patient cannot hold two overlapping appointments.
5 more requirementsUnlock to see all

How well must it do it?

  • No double booking: The database must reject a second booking for the same doctor slot or the same bed.
  • History preserved: Clinical notes and prescriptions are never edited in place; corrections are new versions with the old one kept.
3 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • ER diagram
  • Medical records
  • Appointment scheduling
  • Bed allocation
  • Temporal data
  • Access audit

How you’ll practise

6 short steps · save and come back any time
  1. Access patterns
  2. Entities
  3. Schema
  4. Indexes and queries
  5. Scale and consistency
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any database design round.

  • Lists the entities and how they relate before writing tables
  • Designs the schema around the main access patterns
  • Chooses primary keys, foreign keys and indexes with reasons
  • Explains where to normalise and where to denormalise
  • Considers integrity, transactions and concurrent writes
  • Plans for growth: partitioning, archiving and migrations

Questions people ask about this interview question

Which design type is this question?
It is a database design question. You design a hospital management system database and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
What should I cover first?
Start with the entities and the main queries the database must answer. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Premium questionSign up free, then unlock it