Search code examples
sqldatabasenormalizationrelational

Relational Database emergency person + contact number?


I'm trying to design a normalized relational database where a patient has a *contact person* (person who is contacted in case of emergency). I also have a table called contact_num which takes patient_id as a foreign key. But how can I implement having a emergency contact person (who has a phone number) who may/may not be another patient? Should I implement emergency_contact_num table? Or some kind of unary relationship? egs would be helpful


Solution

  • I think you could have a contacts book, all stored in a database

    So for the patient, the entry into the database could be:

    'id' => '1'
    'first_name' => 'john'
    'last_name' => 'doe'
    'emergency_contact' => '2'

    Of course, you should also include any important information about this person in this table (ex. Phone number). For the emergency contact, the database could be:

    'id' => '2'
    'first_name' => 'lisa'
    'last_name' => 'joe'
    'emergency_contact' => 'none'