Say I want users to pick one or more contact methods (email, phone, fax, other, etc). And if they choose other, then they can enter a single contact method of their own. What's the best way to store this in a database? I see three possibilities:
Any comments on the above, or is there a better solution?
If you have one user and several contact method possibilities, it's most probably a one-to-many relationship. (I would avoid many-to-many wherever you can, because of the additional complexity and the slow down of querying such models.)
users_table
id INTEGER
name VARCHAR
etc.
contacts_table
user_id INTEGER -- foreign key on user.id
contact_method ENUM('email', 'phone', 'mail', 'other')
contact_address VARCHAR
etc.