I have a SQL table Values:
id (int) | group (int) | value (int)
and I want to map a value to string. For one group, one value can only be mapped to one string. From two different groups, one value can be mapped to two different strings.
Is it better to create table like this
map_id (int) | group (int) | value (int) | mapped (string)
or like this
map_id (int) | group (int) | mapping (text)
where mapping is a text field e.g.
5=something
6=another string
7=next string
and finally map in program?
The former is generally better. The latter violates the 1st normal form (1NF). Denormalization is a valid real-life approach, but maybe not for this case.