Hello, newbie programmer here.
I have 3 tables namely product, category, and subcategory. I configured their relationships this way:
Product to Category: Many-to-many
Product to Subcategory: One-to-one
Subcategory to Category: Many-to-one
I added a subcategory_id column which is a foreign key in the product table (for mapping the product and subcategory tables). This works if a product has a subcategory. Now the problem is I have products which doesn't have subcategory. Supposed to be the subcategory_id column will be null, but it's not allowed. Is there a workaround for this? I also think that the relationship configuration has something to do with this. Any thoughts?