Good day everyone,
Iโm creating an app where I have a โItemsโ table and a โCategoriesโ table.
Originally, I had a column โitemCategoryโ within the Items table, so I could filter the items by that category. (e.g: โfruitsโ, โvegetablesโ, โmeatโ, โfrozenโ, โjuicesโ)
But now, I would like to be able to set several categories to a single item. This resembles the concept of adding โtagsโ to the items.
The idea is that later I would be able to filter easily all items that meet a set of selected โcategoriesโ, so as an example, I could then filter all the โfrozen fruitsโ by selecting the โfruitsโ and the โfrozenโ categories.
Also ideally it would be possible for the user to add more โcategoriesโ when creating or editing an item.
Iโve seen the column tupe โEnumListโ, but Iโm not sure if that will be the best solution for later being able to filter easily by one or multiple โcategoriesโ (โfrozen fruitsโ or โfrozen vegetablesโ)
Not sure what the question is.
There is no โbestโ way. EnumList or a separate table both work. EnumList is easier to implement quickly, but may have drawbacks later depending on how your app behaves.
Based entirely on what youโve said in this post, my gut says EnumList.
Thank you Steve,
Indeed, it seems that EnumList will do the work nicely.
User | Count |
---|---|
43 | |
27 | |
23 | |
16 | |
12 |