[Solved] Should I store data in db or should I store it in enum? [closed]


I think it is better store it in a database’s table.

If you store it in a enum, when you add, change or delete a fruit you have to compile your code again. In case of change, you will have to update all places (tables columns) where this fruit’s name is store.

In the database you could opt to save it as a single column table or a two columns table (id, fruit_name).

I will opt the second option. Because if you choose the single column option, and you change a fruit name you will have to change it in all the tables where the fruit name is store (like in enum). A disadvantage with the two columns table is that you will have to make joins with the fruit table to get the fruit name (but make this joins is easy and simple).

0

solved Should I store data in db or should I store it in enum? [closed]