Re: I need a fresh look at storing variables in MySQL
| From: | Paul M Foster | Date: | Sun, 14 Mar 2010 06:14:26 +0000 |
| Subject: | Re: I need a fresh look at storing variables in MySQL | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302789@lists.php.net to get a copy of this message | ||
On Sat, Mar 13, 2010 at 02:45:37PM -0500, Phpster wrote:
> I'd go with a mysql data modelled approach as it will allow mysql to
> do lots of the heavy lifting during analysis as you've mentioned. If
> there are a lot of entries, it's gonna get complex and expensive
> memory-wise to manage XML or session based datasets.
>
> Plus having each question as it's own record should give you greater
> flexibility in packaging the data for analysis and reporting.
>
+1
I invariably find that the original design for a project needs to be
tweaked. The customer wants to add or delete questions, they want to
add/change reports for the data. So I nearly always approach this kind
of project this way. Maybe:
vote table:
id serial/sequence not null primary key
voter_id int references voters (voter_id)
question_id varchar(10)
answer varchar(10)
You can easily subset by voter, or by question ID. Or analyze answers in
relation to other answers, etc.
Paul
--
Paul M. Foster