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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.