MySQL – how to store “other”

database-designMySQL

How to store "other" text?

In summary, I have too many of these kinds of fields (like hundreds?):

http://i.stack.imgur.com/0H81O.png

I don't know an appropriate way to handle this.

If I store only text of these options, then I will have data redundancy and no foreign key. Maybe foreign key does not matter since I am allowing users to store "other" anyway.

Best Answer

If it was a radio list where only one option could be specified then I'd use one column and store the selected value if something other than "other" were picked and the value from the free-text box otherwise.

As it appears that your application allows selecting multiple item (which may or may not include "other") then you need to store a list of possible options per form. A boolean per check box may be inefficient, but do avoid a comma separated list (i.e. a field called "foods" in which you store "rice,soup" in the example you give) as that can make reporting (amongst other things) difficult.

How I would go about storing this data would depend on the amount on the rest of the data set: there are a couple of methods that are optimal for different circumstances. Could you update the question to give more details about the application and its data?