简体   繁体   中英

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.

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

I am also not sure if having a table Medical_Record would be an appropiate solution. 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. 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.

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