Menu

1 / 2

Transforming a Flat Hospital Dataset into a Relational Database Using PostgreSQL

DEV Community: sql·Dennis Wachira·9 days ago
#UHe8h8pf
#devtosql#devto#dev#table#doctor
Long article (372 words) — no AI summary yet.
Reading 0:00
15s threshold

As I continued building my Hospital Records Analysis project, I reached a point where simple SQL queries were no longer enough. Initially, all my hospital information existed in one table, the patient_records . This table contained:

Patient details

Doctor information

Hospital departments

Visit details

Billing information

Payment information

Although this structure was convenient for analysis, it introduced a challenge and it was data repetition. Doctor names and department names were stored repeatedly across thousands of patient records. This led me to my next SQL learning milestone, Database normalization. Moving From One Table to multiple related tables. I separated the data into smaller, purpose-driven tables:

1. Doctors Table

Stores unique doctor information.

doctor_id doctor_name

Enter fullscreen mode

Exit fullscreen mode

Each doctor now has a unique identifier instead of repeating the doctor's name in every record.

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.