[英]How to handle optional fields for this model?
I am working on a small database that has information for staff, teachers and students. 我正在使用一个小型数据库,该数据库具有适用于员工,老师和学生的信息。 Because I am only storing information like
name
, lastname
, gender
, id
and their role
on the sistem I decided to use a Person
table with this fields. 因为我仅在系统上存储诸如
name
, lastname
, gender
, id
及其role
等信息,所以我决定在此字段中使用Person
表。
But here is where I am having trouble, the student can have information like allergies
, blood type
etc. Such information is only applied to the Student
role so I am clearly reluctant in making those columns in Person
但是在这里我遇到了麻烦,学生可以得到诸如
allergies
, blood type
等信息。此类信息仅适用于Student
角色,因此我显然不愿意在“ Person
中创建这些列
I am also not sure if having a table Medical_Record
would be an appropiate solution. 我也不确定是否有一个表
Medical_Record
是否合适。 I was hoping someone could give me some pointers to solve this problem. 我希望有人可以给我一些指导来解决这个问题。
Here is my preliminary design: 这是我的初步设计:
Making another table is suitable for this situation, although you may want to include the users(student) id as a column within the MedicalRecord
table. 尽管您可能希望将users(student)id作为一列包含在
MedicalRecord
表中,但制作另一个表也适用于这种情况。 Then creating a relation between the users id in MedicalRecord
to Person
, this then helps with the time to process a query to fetch a row of the data inside MedicalRecord
with the users id. 然后在
MedicalRecord
的用户ID与Person
之间创建一个关系,这有助于MedicalRecord
时间来处理查询以获取具有用户ID的MedicalRecord
的一行数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.