My data model has 4 tables Storage, Emissions, Infrastructure,
and Projects
.
The Projects
table references the other three tables with many-to-many relationships, and hence I assumed using a Junction table is the logical way forward.
The planned Junction table has the following structure:
My issue is that there are cases where a Project can have no values for Emission, Infrastructure, or Storage. It will always have a value for at least one of these columns, but not always all of them.
I know that junction tables use composite primary keys and hence cannot have null values for its columns. Is there an alternative to this?
P.S. The suggested solution for How can you represent inheritance in a database? cannot be used in my case, as each of these four tables have standalone data and relationships to other tables not mentioned. The question here is solely about representing many-to-many relationships.