|
Posted by Michael Fesser on 01/29/07 13:09
..oO(Larry in Honolulu)
>I'm helping a friend with a website (aren't we all) that will have a long
>questionnaire. There will be about 150 data items, all of which will be chosen
>from radio buttons with four choices each. I'll store the resulting data in a
>MySQL data table, and I'm thinking I don't want 150 fields there.
Correct. Such a structure would be a nightmare to handle and maintain.
>Since all
>the responses can be coded as 1-4 (or 0-3), I'm thinking of storing them in
>groups, with the values just strung together, and later decoded. i.e. 12132
>24331 31142 etc. That would reduce the number of fields to a more manageable
>size.
This is a broken database design, as it already violates the first
normal form. Even worse than the above. Don't do that.
>Any suggestions?
Put them all in a simple table, one record per value. The column type
could be INT or ENUM. For 150 values you would end up with 150 records,
but that's peanuts for a database.
Micha
[Back to original message]
|