Reply to Re: Question about a data structure

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация