I am using MS SQL Server 2012. I have two tables, one for doctors and another for surgery centers. Each table currently contains columns that describe how they (doctors and surgery centers) should receive reports (email, fax…) The columns that hold this data in both tables are identical. I am thinking to pull the delivery method columns out of each table and make a common delivery method table, but I would need to have foreign keys for both the doctor and surgery center in each row. This is troublesome as there is a one to one relationship between the delivery method and the doctors. This same relationship exits for the surgery center table.
Question:
- Is it good practice to have a table with two foreign keys and one of them would always be null?
- What is the best strategy to handle such a case.
The reason I would like to pull the delivery method information from the doctors and surgery center tables is to reduce the overall size of the tables. Also this will better normalize my data. I appreciate any and all help and guidance.
You have the relationship going from the delivery method to the dr/centers, instead of from the dr/center to the delivery method.
If you reverse the relationship, not only do you eliminate the need to have a table with a potentially unsed column, you can share delivery methods amoung multiple drs and centers. You say that there is a 1 to 1 relationship, but if there is not a business rule that PREVENTS a dr or center from having the same delivery method as any other dr or cent, then what you have is actually a many to 1 relationship (many dr/centers can have the same delivery method) even if in practice it is unique.