We need a solution to the following problem which makes sense an also follows best practices without making things to complicated.
We have 3 tables which need to be linked, Sector, Location and Company.
ie: A Company "Bobs B&B" is in Sector "Accommodation" which is in Location "New York". For hotel groups we could have a single company in multiple sectors across multiple locations.
So we decided to simply create a "CompanySectorLocation" table which has 3 primary keys linking the 3 tables:
CompanySectorLocation
CompanyID (PK FK)
SectorID (PK FK)
LocationID (PK FK)
The curved ball here is that the Location is not required.
ie: "Protea Hotels" is active in the "Accomodation" sector leaving the location as NULL.
My developer is very much against having a table that allows for a NULL FK. His suggestion is to create another table called CompanySector which will deal with the links between Company and Sector where Location is not defined.
CompanySector
CompanyID (PK FK)
SectorID (PK FK)
My issue with this is that we will have to maintain 2 tables with effectively duplicate data in them.
What is the best way to do this?