Re: Question about a data structure
- From: Michael Fesser <netizen@xxxxxx>
- Date: Mon, 29 Jan 2007 14:09:57 +0100
..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
.
- Follow-Ups:
- Re: Question about a data structure
- From: Larry in Honolulu
- Re: Question about a data structure
- References:
- Question about a data structure
- From: Larry in Honolulu
- Question about a data structure
- Prev by Date: Re: Question about a data structure
- Next by Date: Re: Question about a data structure
- Previous by thread: Re: Question about a data structure
- Next by thread: Re: Question about a data structure
- Index(es):