Jump to content

How Do I Store Multiple Answers in ONE column?


skidmark10

Recommended Posts

MySQL has a SET column type.  http://dev.mysql.com/doc/refman/5.0/en/set.html

 

As far as I'm concerned the SET type violates basic relational database rules of normalization, as it is essentially a repeating group. 

 

With that said, if you're dead set on using it, it does provide an answer.  I've also seen people store a comma delimited string as a varchar, and even seen people store the data in a varchar or text, in json format. 

 

There's a few solutions, but just know in advance that if you want to query for rows that contain specific values with one of these schemes, retrieval is going to be very slow if the database is at all large, because you will have to read every row, parse the values up and determine whether or not the row contains the value(s) you are looking for.  A normalized design does not have that problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.