Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1080737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:04:38+00:00 2026-05-16T22:04:38+00:00

I have survey statistics – for each answer (there is an arbitary number of

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:04:39+00:00Added an answer on May 16, 2026 at 10:04 pm

    The example has five dimensions: User, Question, Answer, Survey, and Demographic. The Demographic table 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. The CurrentDemographicID in the User table is pre-calculated before the survey, and is later copied to the DemographicKey of the UserQA table.

    alt text

    select 
          AgeGroup
        , IncomeLevel
        , count(1)   as NumberOfPeople
    from UserQA      as f
    join Question    as q on q.QuestionID    = f.QuestionID
    join Answer      as a on a.AnswerID      = f.AnswerID
    join Demographic as d on d.DemographicID = f.DemographicID
    join Survey      as s on s.SurveyID      = f.SurveyID
    where QuestionFullName = 'specific question here'
      and AnswerFullName   = 'specific answer here'
      and SurveyFullName   = 'specific survey here'
    group by AgeGroup, IncomeLevel
    order by AgeGroup, IncomeLevel ;
    

    Also, take a look at this question/answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working survey that pulls each question and any related answers from
I have a survey on a website, and there seems to be some issues
I have essentially a survey that is shown, and people answer questions a lot
I have a survey from 100 users and I'm trying to calculate some statistics.
I have a survey database with one column for each question and one row
I have a Survey model and each survey has_many questions and each question belongs_to
I have a survey type form, and in a number of the questions, the
I have an online survey for my users, and every time user answers a
I have a table of survey answers, something like: date | q1 | q2
I have a table called Survey with a Group Column and a Subject Column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.