I have the following information from two tables (Categories and Subcategories)
Note that in the Subcategories table, Subcategory 1 is repeated in two Categories; in Category A and Category B. My question is, when it comes to relating the two tables, and recording the data in the DB, what is the best way to do it?
At first, I considered relating the two tables directly, with a foreign key in the Subcategories table, and registering the subcategory that is repeated in the DB but in JSON format, like this:
But then I thought about having a detailed table in between, which would allow me to relate the two tables ... The point is that since there is only one subcategory that is repeated (subcategory 1), I don't know if it merits and is worth one detail table to relate the Categories and Subcategories tables; and I also don't know if storing IDs of another entity in JSON format is the best option ...
How can I do it better?
Thank you very much for any help and suggestions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…