Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PatientID

HospitalID

Reason

01

A

Check-up

02

A

Annual Physical

01

B

Follow-up

02

B

Emergency

  • PatientID (Key): This is still the patient's unique identifier, like their name on the sign-in sheet.

  • HospitalID (Key): Indicates which hospital the patient visited, like the location column on the sign-in sheet.

  • Reason: This is the purpose of the visit, like a note that the patient might leave about why they came in.

Without the addition of a third key field, the example above does not make a lot of sense, why can’t Patient 01 visit Hospital A again? This is an example of having 2 key fields in your database table. There can’t be a duplicate of Patient 01 at Hospital A as key fields do not allow that.

To allow for a more than one visit per patient, a third key field needs to be set up. Let’s call it VisitDate:

PatientID

HospitalID

VisitDate

Reason

01

A

Nov-01-2023

Check-up

02

A

Nov-01-2023

Annual Physical

01

B

Nov-01-2023

Follow-up

01

A

Nov-08-2023

Consultation

02

B

Nov-08-2023

Emergency

  • VisitDate (Key): This is the new column we've added. It's like the date next to the patient's name, showing us exactly when they visited.

Notice, Patient 01 visits Hospital A twice which, before we added the third key field, would not be possible. Because the VisitDate is a different value, it makes the entire entry unique due to VisitDate being a key field.

...