我仍然处于在工作中自学数据库设计的开始阶段,我真的想确保我做对了。我有这张医生表,其中一列是他们的头衔(“DDS”、“MD”、“DMD”等)。我在想,既然有成千上万的医生,但可能只有十几个标题,那么为标题单独制作一个表格可能是有意义的,即使标题不是很大。是否有意义?为了在思考过程中再投入一把扳手,有几位拥有多个头衔的医生。如果我确实制作了一个单独的“titles”表,我会在医生表的 titleID 列下放入类似“4,7,9”的内容吗?我认为这不适用于外键引用。有没有“正确”的处理方式?谢谢!
问问题
74 次
1 回答
2
You would have a many to many table relationship between Doctors and Titles.
Something like
tblDoctors
- DoctorID (PK)
- LastName
- FirstName
and then
tblTitles
- TitleID (PK)
- TitleDesc
and then
tblDoctorTitles
- DoctorID (PK,FK)
- TitleID (PK,FK)
When you store it as mentioned (in a single column) you will always have issues later when you wish to query/join these fields, so it would be best to design it correct from the start.
于 2013-10-01T04:37:55.390 回答