简体   繁体   中英

Is this database in 3NF?

I have this database with patients, and I've been asked if it's in 3NF. At a first glance, I thought it was, but when I looked better at Occupy table , I've changed my mind. I am going to explain as much as I can the database.

患者

在此处输入图片说明

wards, the primary key is ( W_id , H_id )

在此处输入图片说明

The final table is the one that made me change my mind about the normalization of this database. This tables says when each patient entered in which ward in which hospital at a specific date. The primary key is also suspicious, it's all the columns, even the entry date.

在此处输入图片说明

This database is give to me like this, with these tables and their primary keys.

The schema of the table "ward" seems not to be in 2NF. W_id seems to determine Wname.

In 2NF every attribute which is not part of the primary key must not be determined by only a part of the primary key. It must only be determined by the whole primary key instead.

A schema that is not in 2NF can not be in 3NF. Therefore this database-schema is not in 3NF.

I have worked on quite a few healthcare applications, I would make the following changes to the schema.

Ward Table

Add an Identity field to Wards Table, Make it the Primary key , Create a unique constraint on H_ID and W_ID.

Occupy Table

In Occupy table

Use the Identity column from Ward table as the reference key, and obviously the P_ID for patients.

A datetime column, to record the datetime for Admission or Discharge.
Another column to record the type of event like (admission, discharge, discharge to another ward, etc) refferencing another column in Event_Types

Create another table for types of event Event_Types referenced by the Event_Type column in Occupy table.

EventTypeID   EventTypeDescription
    1          Admission 
    2          Discharged 
    3          Discharged to Another Ward

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM