Product Categories
ID CategoryName
Product List
ID Name CategoryName (the question is, here, the ID of the product category or the CategoryName of the commodity category)
Most people say to fill in the ID, but the product classification has been deleted, what about the product?
What is the problem with copying the CategoryName of the product category directly into the CategoryName of the commodity table?
Whether this is a matter of inverse paradigm design.
Reply content:
Product Categories
ID CategoryName
Product List
ID Name CategoryName (the question is, here, the ID of the product category or the CategoryName of the commodity category)
Most people say to fill in the ID, but the product classification has been deleted, what about the product?
What is the problem with copying the CategoryName of the product category directly into the CategoryName of the commodity table?
Whether this is a matter of inverse paradigm design.
I think we should fill in the ID, this conforms to the general principle.
If you fill in the classification name directly, it is not possible, but at least two problems: 1, if the name changes, you need to update all records, 2, from the query point of view, when the need to filter items according to the classification of the ID is faster than the classification name.
If the product classification is deleted, you will need to look for the commodity table if you fill in the ID or the classification name in the product table, otherwise the data is inconsistent.