SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict aniltc's Avatar
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    questionnaire database and preorder traversal tree alogorithm

    HI all

    I need to create a questionnaire dataabse.My questionnaire is dynamic.It's having yes/no type questions.I need to implement the databse tables based on the 'yes/no'

    Which is the best method?

    Can I use modified pre order traversal algorithm for this scenario?

    please give me your suggestions ?

    Thanks to all

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,215
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    i don't see how or why your questions would be arranged hierarchically
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,139
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    If it is known that the questions will always be yes/no than its just a standard 1:m relationship.

    questionnaire
    - id (pk)

    questionnaire_question
    - id (pk)
    - questionnaire_id (fk)
    - question

    questionnaire_answer
    - questionnaire_question_id (fk)
    - user_id (reference to user)
    - yes (0 or 1 value stored as TINYINT)
    pk(questionnaire_question_id,users_id)

    for example
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

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