Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    37

    A simple survey table design

    I need to have a set of DB tables for web site polls. A poll is in a form of multiple choice question. The number of choices can vary from a question to another. A poll result need to reported in term of total result, two genders' result. I'm thinking a table is something like

    question_id int2
    question varchar(255)
    gender char(1)
    number integer

    I don't feel the table is quite right. Any suggestions?

    Thanks,

    v.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171

    Re: A simple survey table design

    Originally posted by vwu98034
    I need to have a set of DB tables for web site polls. A poll is in a form of multiple choice question. The number of choices can vary from a question to another. A poll result need to reported in term of total result, two genders' result. I'm thinking a table is something like

    question_id int2
    question varchar(255)
    gender char(1)
    number integer

    I don't feel the table is quite right. Any suggestions?

    Thanks,

    v.
    Your table seems to be trying to hold both the questions and the replies. These should be in separate tables.

  3. #3
    Join Date
    Jan 2003
    Location
    Pittsburgh, PA
    Posts
    86

    Re: A simple survey table design

    You will want to use separate tables for the responses and the questions. You'll need a foreign key in the "response" table that will allow you to link back to the "question" table. It will be a many-to-one relationship (i.e. many responses for one question).

    Are you intending to restrict a user from responding more than one time? If so, you will need to capture some user information (user_id or ip_address, or some unique qualifier), and put a constraint on the user/question combination.

  4. #4
    Join Date
    Oct 2002
    Posts
    37
    Thanks both for your input. I know what the question and answer tables shall look like now.

    v.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •