I have the following three tables:
- Item
- Code
- ItemCode (many to many relationship between Item and Code)
And then I have the following sample data on the third table:
Item | Code
-----+-----
001 | A
002 | A
003 | B
There's a possibility that a new Item is added but does not have a code yet. I will assign a default code for this Item, say "Z".
My question is, which is better:
- adding an entry in the ItemCode table every time a new Item is created (with the code value to "Z")
OR
- retrieve the default value from configuration file (and keep the ItemCode table clean from default value entries)
Additional consideration: the default code will always be returned, regardless whether an Item have been assigned a Code or not. So the result from the above data would be:
Code A: Item 001, Item 002
Code B: Item 003
Code Z: Item 001, Item 002, Item 003