关系数据库紧急人+联系电话? [英] Relational Database emergency person + contact number?

查看:197
本文介绍了关系数据库紧急人+联系电话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个标准化的关系数据库,其中患者具有 * 联系人 * (在紧急情况下联系的人)。我还有一个名为contact_num的表,它将patient_id作为外键。但是如何实现有一个紧急联系人(谁有一个电话号码)谁可能/可能不是另一个病人?我应该实现emergency_contact_num表吗?还是某种一元关系?

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

推荐答案

我认为你可以有一个通讯录,都存储在数据库中

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'

这篇关于关系数据库紧急人+联系电话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆