I have survey statistics – for each answer (there is an arbitary number of answers) – I need to know the age group and the income group. (E.g. – answer “a” was answered by 23 people of ages 30 to 35, and by 11 people with income level of 10,000 to 15,000. and by 7 people of ages 30 to 35 with income level of 10,000 to 15,000 (this can be inferred by the first two requirements. Those groups are predefined).
This is actually a “cube” With:
1st dimension – answer id, 2nd dimension – age group, 3rd dimension – income group.
How should I represent it in the DB (using tables)? Can you make a generalization for cases where I need more than 3 dimensions of data?
Thank you all in advance.
The example has five dimensions:
User,Question,Answer,Survey, andDemographic. TheDemographictable is here to freeze the income level and age group at the time of the survey — the user can change income and age over time. TheCurrentDemographicIDin theUsertable is pre-calculated before the survey, and is later copied to theDemographicKeyof theUserQAtable.Also, take a look at this question/answer.